[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: XSL resources - Flat to hierarchy - Common ancesto
> > 2. Transforming 'flat' structures to hierarchies: > .... > > Wrap the first apply-templates into a variable, use your processors node- > set() > function (see your processors documentation on how to implment this) to > convert > the result into a node-set and then apply-templates or for-each through > the > resulting node-set using <xsl:number/> to accomplish the task > I'm supposed to be doing something else, but I just had to try this out :) Having 'learnt' XSL by cut and paste, I think I'm still at the stage where I need subtitles. I added xmlns:msxsl="urn:schemas-microsoft-com:xslt" to my xsl:stylesheet declaration, and my first template now looks like this: <xsl:template match="/"> <xsl:variable name="menus"> <xsl:apply-templates select="Menus"/> </xsl:variable> <xsl:for-each select="msxsl:node-set($menus)"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:attribute name="TOC"> <xsl:number level="multiple" format="1.1"/> </xsl:attribute> </xsl:copy> </xsl:for-each> </xsl:template> Obviously, it doesn't work, otherwise I wouldn't be posting. I guess what I don't understand is whether my for-each is for each node in the nodeset. You suggested mayb using an apply-templates, but I don't really understand how to do an apply templates which won't eat my other menus upstream (ok, I'll be honest, I just don't understand apply-templates ;) Ben
|
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
|