XML - XSL Conveting
I have just started learning about XML. Everything seemed to be going smooth until i encountered my first up-hill: Converting with the MSXSL command. I get the error: "Keyword xsl:apply-template may not be used here."
The source files are picked up from the XML book:
XML code:
<?xml version="1.0"?>
<order>
<salesperson>John Doe</salesperson>
<item>Production Class-Widget</item>
<quantity>16</quantity>
<date>
<month>1</month>
<day>13</day>
<year>2005</year>
</date>
<customer>Sally Finkelstein</customer>
</order>
XSL code:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<xsl:template match="/">
<order>
<date>
<xsl:value-of select="order/date/year"/>
<xsl:value-of select="order/date/month"/>
<xsl:value-of select="order/date/day"/>
</date>
<customer>Company A</customer>
<item>
<xsl:apply-template select="order/item"/>
<quantity><xsl:value-of select="order/quantity"/></quantity>
</item>
</order>
</xsl:template>
<xsl:template match="item">
<part-number>
<xsl:choose>
<xsl:when test=". = 'Production-Class Widget'">E16-25A</xsl:when>
<xsl:when test=". = 'Economy-Class Widget'">E16-25B</xsl:when>
<xsl:otherwise>00</xsl:otherwise>
</xsl:choose>
</part-number>
<description><xsl:value-of select="."/></description>
</xsl:template>
</xsl:stylesheet>
the xml and xsl source files are located in C:\input
The msxsl.exe file is planted in the C:\Winnt directory
The xmlsdk.msi is installed ok..
Here is what i wrote at the command promt:
C:\WINNT>msxsl c:\input\filename.xml c:\input\filename2.xsl
According to the book, this is the way to do it...
I'll be glad for any answer on this..
Peter
|