Jump to content

Recommended Posts

Posted

Hi, this is my first attempt at xslt, and I can't get it to work.I get the error "End tag 'li' does not match the start tag 'xsl:value-of' " when I run this xsl code;

<?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"					xmlns:w="http://http://schemas.microsoft.com/office/word/2003/wordml"											xmlns:o="http://urn:schemas-microsoft-com:office:office"><xsl:template match="/">  <html>  <body>	   <ul>		  <li><xsl:value-of select="//w:wordDocument/o:DocumentProperties/o:Words/text()"></li>	  </ul>  </body>  </html></xsl:template></xsl:stylesheet>

What am I doing wrong?Thanks

Posted

And if I change the select path to:

  <body>	<ul>	   		<li><xsl:value-of select="//o:DocumentProperties/o:Words"/></li>	</ul>  </body>

I get a bullet point with no text. I've tried this path in XMLSpy and it finds the number of words in my xml doc, so I don't understand why it isn't working when in this XSL file.

Posted
And if I change the select path to:
  <body>	<ul>	   		<li><xsl:value-of select="//o:DocumentProperties/o:Words"/></li>	</ul>  </body>

I get a bullet point with no text. I've tried this path in XMLSpy and it finds the number of words in my xml doc, so I don't understand why it isn't working when in this XSL file.

As I've said before (3 times now)...post the XML (if it's really long, just use a portion)If you're new to XML throw out the schema refrences.
<?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="wordDocument/DocumentProperties">	<html>		<body>			<xsl:for-each select="Words">				<p>					<xsl:value-of select="w"/>				</p>			  </xsl:for-each>		</body>	</html></xsl:template></xsl:stylesheet>

I'm more familiar with refrences to the wordDocument/body sections...so I'm just guess on this with the XML

Posted
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><?xml-stylesheet type="text/xsl" href="trial2.xsl"?><w:wordDocument xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:sl="http://schemas.microsoft.com/schemaLibrary/2003/core" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" w:macrosPresent="no" w:ocxPresent="no" xml:space="preserve" w:embeddedObjPresent="yes">	<o:SmartTagType o:namespaceuri="urn:schemas-microsoft-com:office:smarttags" o:name="State"/>	<o:SmartTagType o:namespaceuri="urn:schemas-microsoft-com:office:smarttags" o:name="country-region"/>	<o:SmartTagType o:namespaceuri="urn:schemas-microsoft-com:office:smarttags" o:name="PlaceName"/>	<o:SmartTagType o:namespaceuri="urn:schemas-microsoft-com:office:smarttags" o:name="City"/>	<o:SmartTagType o:namespaceuri="urn:schemas-microsoft-com:office:smarttags" o:name="place"/>	<o:DocumentProperties>		<o:Author>Alex Hall</o:Author>		<o:LastAuthor>Alex Hall</o:LastAuthor>		<o:Revision>2</o:Revision>		<o:TotalTime>0</o:TotalTime>		<o:Created>2007-01-24T17:05:00Z</o:Created>		<o:LastSaved>2007-01-24T17:05:00Z</o:LastSaved>		<o:Pages>1</o:Pages>		<o:Words>4384</o:Words>		<o:Characters>24990</o:Characters>		<o:Company>ACCENT</o:Company>		<o:Lines>208</o:Lines>		<o:Paragraphs>58</o:Paragraphs>		<o:CharactersWithSpaces>29316</o:CharactersWithSpaces>		<o:Version>11.6568</o:Version>	</o:DocumentProperties></w:wordDocument>

Posted

I see an error in your namespace references and that is that you have one extra http:// in each.Try this:

<?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"					xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml"											xmlns:o="urn:schemas-microsoft-com:office:office"><xsl:template match="/">  <html>  <body>	   <ul>		  <li><xsl:value-of select="//o:DocumentProperties/o:Words" /></li>	  </ul>  </body>  </html></xsl:template></xsl:stylesheet>

If that doesn't work, try to omit the namespace references completely. I think that scince they are prefixed in the XML, they don't need to be redeclared in the XSLT.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...