This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Apply-templates for getting around my XML doc?
- To: XSL-List at mulberrytech dot com
- Subject: Apply-templates for getting around my XML doc?
- From: emitchell154 at cs dot com
- Date: Wed, 11 Oct 2000 10:33:25 -0400
- Reply-To: xsl-list at mulberrytech dot com
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@hotmail.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list