Hello,
I have the following XML strcture.
<office>
<table>
<header-rows>
<table-row>
<table-cell>
<p>sequencey</p>
</table-cell>
<table-cell>
<p>id</p>
</table-cell>
<table-cell>
<p>gif</p>
</table-cell>
</table-row>
</header-rows>
<table-row>
<table-cell>
<p>1</p>
</table-cell>
<table-cell>
<p>help</p>
</table-cell>
<table-cell>
<p>01_help</p>
</table-cell>
</table-row>
<table-row>
.................
</table-row>
</table>
</office>
I want to get the following output:
<icon sequence="1" id="help" gif="01_help"/>
I tried this using following XSL but i didnt get the
expected result..
--------------------------------------------------------------------
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="office">
<layout>
<xsl:apply-templates select="table"/>
</layout>
</xsl:template>
<xsl:template match="table">
<xsl:for-each select="table-row">
<xsl:element name="icon">
<xsl:for-each select="table-cell">
<xsl:attribute
name="{../preceding-sibling::header-rows/table-row/table-cell[position()]/p}"><xsl:value-of
select="p"/></xsl:attribute>
</xsl:for-each>
</xsl:element>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
------------------------------------------------------------------
I got the following output:
<layout><icon sequencey="01_help"/></layout>
Is any other way to solve this problem?
Thanks in advance
Regards,
Raj
__________________________________
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--