|
Subject: Re: [xsl] nested for-each to create a html table From: omprakash.v@xxxxxxxxxxxxx Date: Thu, 19 May 2005 17:03:10 +0530 |
Hi,
Here's my solution that makes use of the xalan:nodeset extension
function.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xalan
="http://xml.apache.org/xalan">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xsl:for-each select="Results/Rows/Row">
<xsl:variable name="currRow">
<xsl:copy-of select="*"/>
</xsl:variable>
<xsl:for-each select="/Results/Columns/Column">
<xsl:variable name="coln">
<xsl:value-of select="colName"/>
</xsl:variable>
<xsl:value-of select="xalan:nodeset($currRow)/*[name()
= $coln]"/>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Cheers,
Omprakash.V
Santosh N
<ss1722@yahoo To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
.com> cc: (bcc: omprakash.v/Polaris)
Subject: Re: [xsl] nested for-each to create a html table
05/19/2005
04:15 PM
Please
respond to
xsl-list
I think was not very clear with my question. If you see the xml the
colName of Columns is the elements in Row node. In the inner loop
will get the element name from colName and need to get the value of
this element of outer loop. I want the results like below.
New 0.12.87682 AE Sent
New 0.12.87683 CE Sent
Thanks
Santosh
--- Santosh N <ss1722@xxxxxxxxx> wrote:
> Hi,
>
>
> In the below XML file, have a nested for-each some thing like below
> xsl. Can some one help me with what should be the
> xsl code i should use to get the value of outer Row value from
> inside
> the inner loop..
>
> Thanks
> Santosh
>
> <xsl:for-each select="Results/Rows/Row">
> <xsl:for-each select="Results\Columns\Column">
> <xsl:value-of select="colName"/> //Need help here
> </xsl:for-each>
> </xsl:for-each>
>
> <?xml version="1.0" encoding="UTF-8"?><Results>
> <Results>
> <Columns>
> <Column indx="0">
> <colName>flowStatus</colName>
> <displayName>Status</displayName>
> <dataType>text</dataType>
> <colSelected>Y</colSelected>
> </Column>
> <Column indx="1">
> <colName>associatedTradeID</colName>
> <displayName>TradeId</displayName>
> <dataType>text</dataType>
> <colSelected>Y</colSelected>
> </Column>
> <Column indx="2">
> <colName>event</colName>
> <displayName>LastEvt</displayName>
> <dataType>text</dataType>
> <colSelected>Y</colSelected>
> </Column>
> </Columns>
> <Rows>
> <Row>
> <flowStatus>New</flowStatus>
> <associatedTradeID>0.12.87682</associatedTradeID>
> <event>AE Sent</event>
> </Row>
> <Row>
> <flowStatus>New</flowStatus>
> <associatedTradeID>0.12.87683</associatedTradeID>
> <event>CE Sent</event>
> </Row>
> </Rows>
> </Results>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
>
Yahoo! Mail
Stay connected, organized, and protected. Take the tour:
http://tour.mail.yahoo.com/mailtour.html
This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only.
If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited.
Visit Us at http://www.polaris.co.in
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] nested for-each to create, Rudolf P . Weinmann | Thread | Re: [xsl] nested for-each to create, David Carlisle |
| Re: [xsl] XSL not working in Firefo, Colin Paul Adams | Date | Re: [xsl] XSL not working in Firefo, Joe Fawcett |
| Month |