Apply-templates for getting around my XML doc?
Hello Imagine an XML doc with 'letter' elements, in doc order, from A-Z. Each 'letter' element has 10 child 'digit' elements, 0-9, and each digit element number '0' has 10 'roman numeral 'children, i-ix, so that a random letter, say, L, looks like this: <L> <0>...</0> <i>...</i> <ii>...</ii> //etc. <ix>...</ix> <1>...</1> <!--no roman numeral children--> <2>...</2> //etc </L> <M> <0>...</0> <i>...</i> //and so on OK. If I wanted to process specific elements only, and no others, in the order listed in the stylesheet, would the following XSLT be a correct way to navigate around? <xsl:stylesheet etc.> <xsl:template match='/'> <xsl:apply-templates select="/L/0/iii"/> <!-- does this pass the ball directly to the template listed below?--> </xsl:template> <xsl:template match="/L/8/iii"> <!--do something--> <xsl:apply-templates select="/X/4/vii"/> <!--and then does this go to the next template?--> </xsl:template> <xsl:template match="/X/4/vii"> <!--do domething--> <xsl:apply-templates select="/L/0/i"/> </xsl:template> <xsl:template match="/L/0/i"> <!--this is where I had a problem. Should it have jumped up again and matched this? It didn't--> <!--do domething--> <xsl:apply-templates select="(next victim) etc. Hopefully this can eliminate [this style of navigating] as a potential error. I don't understand how the processor thinks, and I had some problems with templates being ignored, but a wise man recommended this style as a [simple-enough-for-even-me-to-understand] potential solution. Have I missed even that boat? Thanks Edmund p.s.-processor=xt standalone edmund_mitchell@xxxxxxxxxxx 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