|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XML to XML
This isn't necessarily the bet way but it works.
<xsl:template match="Categories"> <xsl:apply-templates select="//Category[string-length(Code)=1]"> <xsl:sort select="Code"/> </xsl:apply-templates> </xsl:template> <xsl:template match="Category"> <LevelOneCategory Code="{Code}" Description="{Description}"> <xsl:apply-templates select="../Category[string-length(Code)=2 and substring(Code,1,1)=substring(current()/Code,1,1)]" mode="two"> <xsl:sort select="Code"/> </xsl:apply-templates> </LevelOneCategory> </xsl:template> <xsl:template match="Category" mode="two"> <LevelTwoCategory Code="{Code}" Description="{Description}"> <xsl:apply-templates select="..//Category[string-length(Code)=3 and substring(Code,1,2)=substring(current()/Code,1,2)]" mode="three"> <xsl:sort select="Code"/> </xsl:apply-templates> </LevelTwoCategory> </xsl:template> <xsl:template match="Category" mode="three">
<LevelThreeCategory Code="{Code}" Description="{Description}">
</LevelThreeCategory>
</xsl:template><xsl:template match="text()"> </xsl:template> <xsl:template match="text()" mode="two"> </xsl:template> <xsl:template match="text()" mode="three"> </xsl:template> At 02:25 PM 3/26/03 -0600, you wrote: I need some help in writing xsl to transform XML to XML. I am getting lost in concepts of having multiple templates
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








