-
ADO, XML accessing a parent node's row context from a child node attributes???
Hi All
Extract of style sheet, I do not seem to understand how to refernce a parent
node when I processing the
inner <xsl:for-each select='@*'>, I want to fill the HREf with the orderID
that is in the <xsl:for-each select='z:row'>
outer loop I thought that preceeding a filter with ".." allow access to the
parent node values eg.
<xsl:value-of select="..['@OrderID']" /> would return in the current row
context the value of the orderid
associated with the "OrderNUmber"
<xsl:template match="xml/rs:data">
<xsl:for-each select='z:row'>
<tr>
<xsl:for-each select='@*'>
<td nowrap="nowrap" class='Cell'>
<xsl:choose>
<xsl:when test=".[nodeName()='OrderNumber']">
<a>
<xsl:attribute name="HREF">Order.asp?OrderID=<xsl:value-of
select="..['@OrderID']" />
</xsl:attribute>
<xsl:value-of match='.'/>
</a>
</xsl:when>
</xsl:choose>
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</xsl:template>
Extract of xml ado data looks like
<rs:data>
<z:row OrderNumber='71826' OrderID='71826' ...bunch of other fields />
</rs:data>
</xml>
-
Re: ADO, XML accessing a parent node's row context from a child node attributes???
Figured this out about 2 sec's after i hit the send
<xsl:value-of select="../@OrderID" />
or of course you can go <xsl:value-of select="context(-2)/@OrderID" />
TC wrote in message <38ea66c8@news.devx.com>...
>Hi All
>
>Extract of style sheet, I do not seem to understand how to refernce a
parent
>node when I processing the
>inner <xsl:for-each select='@*'>, I want to fill the HREf with the orderID
>that is in the <xsl:for-each select='z:row'>
>outer loop I thought that preceeding a filter with ".." allow access to the
>parent node values eg.
><xsl:value-of select="..['@OrderID']" /> would return in the current row
>context the value of the orderid
>associated with the "OrderNUmber"
>
><xsl:template match="xml/rs:data">
> <xsl:for-each select='z:row'>
> <tr>
>
> <xsl:for-each select='@*'>
> <td nowrap="nowrap" class='Cell'>
> <xsl:choose>
> <xsl:when test=".[nodeName()='OrderNumber']">
> <a>
> <xsl:attribute name="HREF">Order.asp?OrderID=<xsl:value-of
>select="..['@OrderID']" />
> </xsl:attribute>
> <xsl:value-of match='.'/>
> </a>
>
> </xsl:when>
> </xsl:choose>
>
> </td>
> </xsl:for-each>
> </tr>
> </xsl:for-each>
></xsl:template>
>
>Extract of xml ado data looks like
>
><rs:data>
> <z:row OrderNumber='71826' OrderID='71826' ...bunch of other fields />
>
></rs:data>
></xml>
>
>
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|