[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Good Afternoon. I am new to Xpath, XSLT and FOP so any help would be greatly appreciated!!!
I have an xml doc with the following structure:
Contract -> Estimate ->itemGroup -> topSecion ->Section -> Item ->Location
In my XSL-FO I am essentially traversing through all locations that are under the root contract. For-each of these locations I then want to check and see if any Item has this location (by comparing a Location element).
My problem is while at the lowest level of Location I need to step up the hierarchy to the itemGroup level to check only those items. I have tried a number of variations but cant seem to get it quite right.
Any help would be greatly appreciated!!!
The inner loop has been my problem and have tried these options already with no success: 1. <xsl:for-each select=" ancestor-or-self::node()/ancestor-or-self::node()/ancestor-or-self::node()/ancestor-or-self::node()/items">
2. <xsl:for-each select="ancestor::node()/ancestor::node()/ancestor::node()/ancestor::node()/items">
3. <xsl:for-each select="parent::node()/parent::node()/parent::node()/parent::node()/items">
<fo:table-body>
<xsl:for-each select="./topSections/sections/items/locations">
<xsl:variable name="locName"><xsl:value-of select="name" /></xsl:variable>
<fo:table-row>
<fo:table-cell>
<fo:block text-align="center">
<xsl:value-of select="$locName" />
</fo:block>
</fo:table-cell>
<!-- Iterate though all items and see if they have a location same as outer loop
Display the quantity if it is. -->
<xsl:for-each select="ancestor::node()/ancestor::node()/ancestor::node()/ancestor-or-self::node()/items">
<fo:table-cell>
<fo:block text-align="center">
<xsl:for-each select="./locations[name=$locName]"> <xsl:value-of select="quantity" />
</xsl:for-each>
</fo:block>
</fo:table-cell>
</xsl:for-each> </fo:table-row>
</xsl:for-each> </fo:table-body>
[xsl] XPath Traversing UP the Hierarchy
Subject: [xsl] XPath Traversing UP the Hierarchy From: "Grant Bryce" <grant_bryce@xxxxxxxxxxx> Date: Tue, 10 May 2005 11:05:16 -0700 |
Good Afternoon. I am new to Xpath, XSLT and FOP so any help would be greatly appreciated!!!
I have an xml doc with the following structure:
Contract -> Estimate ->itemGroup -> topSecion ->Section -> Item ->Location
In my XSL-FO I am essentially traversing through all locations that are under the root contract. For-each of these locations I then want to check and see if any Item has this location (by comparing a Location element).
My problem is while at the lowest level of Location I need to step up the hierarchy to the itemGroup level to check only those items. I have tried a number of variations but cant seem to get it quite right.
Any help would be greatly appreciated!!!
The inner loop has been my problem and have tried these options already with no success: 1. <xsl:for-each select=" ancestor-or-self::node()/ancestor-or-self::node()/ancestor-or-self::node()/ancestor-or-self::node()/items">
2. <xsl:for-each select="ancestor::node()/ancestor::node()/ancestor::node()/ancestor::node()/items">
3. <xsl:for-each select="parent::node()/parent::node()/parent::node()/parent::node()/items">
<fo:table-body>
<xsl:for-each select="./topSections/sections/items/locations">
<xsl:variable name="locName"><xsl:value-of select="name" /></xsl:variable>
<fo:table-row>
<fo:table-cell>
<fo:block text-align="center">
<xsl:value-of select="$locName" />
</fo:block>
</fo:table-cell>
<!-- Iterate though all items and see if they have a location same as outer loop
Display the quantity if it is. -->
<xsl:for-each select="ancestor::node()/ancestor::node()/ancestor::node()/ancestor-or-self::node()/items">
<fo:table-cell>
<fo:block text-align="center">
<xsl:for-each select="./locations[name=$locName]"> <xsl:value-of select="quantity" />
</xsl:for-each>
</fo:block>
</fo:table-cell>
</xsl:for-each> </fo:table-row>
</xsl:for-each> </fo:table-body>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xsl:stylesheet vs xsl:tra, David Carlisle | Thread | RE: [xsl] XPath Traversing UP the H, Michael Kay |
Re: [xsl] Two-level grouping proble, Max Bronsema | Date | RE: [xsl] XPath Traversing UP the H, cknell |
Month |