Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - XPath Node Reference Question >Thread Next - Re: XPath Node Reference Question Re: XPath Node Reference QuestionTo: NULL Date: 3/1/2006 6:11:00 PM
andy.dreistadt@g... wrote:
> I realize that the test in the xsl above is comparing the value of the
> element and whenever the value of the current node is equal to the
> value of B[1] the test passes and outputs "first B". In reality
> however, I need to only identify the actual first child
Well you can simply check the position e.g.
<xsl:if test="position() = 1">
at least as long as you process all B elements in one step. Of course if
you don't have any other templates than
<xsl:template match="B">
then position will be relative to all child nodes and not all B
siblings. So a template
<xsl:template match="A">
<xsl:apply-templates select="B" />
</xsl:template>
might be necessary for the above suggestion.
Or you can do e.g.
<xsl:if test="generate-id() = generate-id(../B[1])">
to compare node identity and not node value.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
