 |
 |
 |
Hi,
Are you looking for something like below:
<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="utf-8"/>
<!--Look in the Results-->
<xsl:template match="/">
<!--First Find All The Portfolios-->
<xsl:apply-templates
select="/weather-report/weather-details/weather-data-list"/>
</xsl:template>
<!--Process The Portfolios-->
<xsl:template match="weather-data-list">
<xsl:for-each
select="/weather-report/weather-details/weather-data-list/weather-data">
<xsl:text>
</xsl:text>
<xsl:variable name="coltoselect" select="."/>
<xsl:for-each
select="/weather-report/report-format/column-list/column">
<xsl:variable name="coltext" select="."/>
<xsl:for-each select="$coltoselect//* | $coltoselect/@*">
<xsl:if test="local-name(.) = $coltext">
<xsl:value-of select="."/>
<xsl:text> </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
cheers,
prakash
PCWETZEL@xxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
05/31/2006 11:12 cc: (bcc: omprakash.v/Polaris)
PM Subject: [xsl] Dynamically ordering/displaying columns specified inside of xml
Please respond
to xsl-list
Hi everyone, I'm kinda new to XSL and have a XML file that I'm looking to
transform to an HTML table via XSLT. The problem lies in where the XML
file actually contains the instructions of which data columns to display
and in what order. Below is my XML where the columns are listed in the
"/weather-report/report-format-column-list" and the actual data is in
"/weather-report/weather-details/weather-data-list". The values in
<column> are the element/attribute names in the <weather-data> nodes. I
have so ability to change the <report-format> node set but no the
<weather-details> node set. Any help would be appreciated.
<weather-report>
<report-format>
<column-list>
<column order="1">location</column>
<column order="2">temperature</column>
<column order="3">cloud-coverage</column>
<column order="4">accumulation</column>
<column order="5">parcipitation-chance</column>
</column-list>
</report-format>
<weather-details>
<weather-data-list>
<weather-data location="SFO">
<clouds>
<cloud-coverage>0.80</cloud-coverage>
<altitude>10000</altitude>
</clouds>
<parcipitation>
<parcipitation-chance>0.25</parcipitation-chance>
<accumulation>0.0</parcipitation-chance>
</parcipitation>
<temperature>68</temperature>
<wind-mph>10 NNW</wind-mph>
</weather-data>
<weather-data location="DET">
<clouds>
<cloud-coverage>0.95</cloud-coverage>
<altitude>12000</altitude>
</clouds>
<parcipitation>
<parcipitation-chance>0.95</parcipitation-chance>
<accumulation>3.2</parcipitation-chance>
</parcipitation>
<temperature>57</temperature>
<wind-mph>1 E</wind-mph>
</weather-data>
</column-list>
<weather-details>
</weather-report>
Thanks,
Pete
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
|
 | 

|  |
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.
|  |
| |
 |
 |
 |