[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Fwd: Selecting First Child of Ancestor using Xpath


Subject: Re: [xsl] Fwd: Selecting First Child of Ancestor using Xpath
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Wed, 20 Nov 2013 16:29:29 +0100

Nathan Tallman wrote:

I'm working on a template that matches on c04, then has an
xsl:for-each for the did (so did is m context node). I am transforming
this into an HTML table.

I'd like to do an xsl:coose/when to test for the first c04 child of
c03, so I can add table headers. As this is processing all dids I need
the test to specifically catch the first c04 child. However
test="../../c04[1]" does not seem to be doing the trick.

You could test
<xsl:if test=".. is ../../c04[1]">
to check whether the parent of the context node is the first c04 child element of the ancestor.


It all looks to me as if you should rather change the approach to use matching template with appropriate match patterns and apply-templates instead of "for-each".


Current Thread