W
William Krick
Given this XML
<parent>
<child name="billy">
<child name="sue">
</parent>
I can use this to process each child...
<xsl:for-each select="child">
<xsl:value-of select="@name" />
</xsl:for-each>
but if I want to only output info from the first child, I need to use
this...
<xsl:value-of select="child/@name" />
Is there some way to scope to the first child like this...
<xsl:first select="child">
<xsl:value-of select="@name" />
</xsl:first>
obviously, this is a contrived example but imagine if child had 40
attributes...
<xsl:value-of select="child/@name" />
<xsl:value-of select="child/@age" />
<xsl:value-of select="child/@haircolor" />
<xsl:value-of select="child/@eyecolor" />
etc...
It seems like there should be a way to avoid having to prefix the XPath
for each select with "child/".
<parent>
<child name="billy">
<child name="sue">
</parent>
I can use this to process each child...
<xsl:for-each select="child">
<xsl:value-of select="@name" />
</xsl:for-each>
but if I want to only output info from the first child, I need to use
this...
<xsl:value-of select="child/@name" />
Is there some way to scope to the first child like this...
<xsl:first select="child">
<xsl:value-of select="@name" />
</xsl:first>
obviously, this is a contrived example but imagine if child had 40
attributes...
<xsl:value-of select="child/@name" />
<xsl:value-of select="child/@age" />
<xsl:value-of select="child/@haircolor" />
<xsl:value-of select="child/@eyecolor" />
etc...
It seems like there should be a way to avoid having to prefix the XPath
for each select with "child/".