|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] copying attributes
When converting the result of three SQL queries to xml I generate something
like;
<breakfasts>
<life_to_date>
<z breakfast="bacon" servings="2000"/>
<z breakfast="eggs" servings="2000"/>
<z breakfast="cereal" servings="7000"/>
</life_to_date>
<y2000>
<z breakfast="bacon" servings="130">
<z breakfast="eggs" servings="100">
</y2000>
<january>
<z breakfast="eggs" servings="1">
</january>
</breakfasts>
..you can assume that any 'breakfast' types in the y2000 and january nodes
will show in the life_to_date node..
I would like to load this xml into a Data Source Object using the following
format;
<z breakfast="bacon" january_servings="" y2000_servings="130"
life_to_date_servings="2000"/>
<z breakfast="eggs" january_servings="1" y2000_servings="100"
life_to_date_servings="2000"/>
<z breakfast="cereal" january_servings="" y2000_servings=""
life_to_date_servings="7000"/>
Can I transform into this format? If so how?
In trying to create the 'january_servings' node I've tried;
<xsl:template match="/breakfasts/life_to_date/z">
<z>
<xsl:for-each select="@breakfast" >
<xsl:attribute name="breakfast"><xsl:value-of
select="."/></xsl:attribute>
<xsl:attribute name="january_servings"><xsl:value-of
select="/breakfasts/january[@breakfast=.]/@servings"/>
</xsl:attribute>
</xsl:for-each>
</z>
</xsl:template>
But with no success...could anyone help me out here? I'm trying to say for
each life_to_date/z node, iterate through the 'breakfast' attributes and
create new attributes with values that match the value of the corresponding
'january' node..where the 'breakfast' attibutes match..
Thanks heaps,
Russ
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








