Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XPath Node Reference Question

From: Martin Honnen <mahotrash@-----.-->
To: 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/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent