Hello Guys.
So This is my xml file and I would like to have the same ID in TABLEID and TABLEROOM
<?xml version="1.0"?>
<root>
<Rooms>
<Room>
<RommName>Suite</RommName>
<Informations>
<I>
<Currency>USD</Currency>
<Information>Internet</Information>
</I>
<price>
<A Date="31.01.2005"> 100</A>
<A Date="31.03.2005">411</A>
<A Date="30.09.2005">452</A>
<A Date="31.12.2005">452</A>
<B Date="31.01.2005">462</B>
<B Date="31.03.2005"> 125</B>
<B Date="30.09.2005">350</B>
<B Date="31.12.2005">453</B>
</price>
</Informations>
</Room>
<Room>
<RommName>Suite</RommName>
<Informations>
<I>
<Currency>USD</Currency>
<Information>Internet</Information>
</I>
<price><A Date="31.01.2005"> 115</A>
<A Date="31.03.2005">114</A>
<A Date="28.09.2005">115</A>
<A Date="31.12.2005">156</A>
<B Date="31.01.2005">456</B>
<B Date="31.03.2005"> 245</B>
<B Date="30.09.2005">250</B>
<B Date="25.12.2005">454</B>
</price>
</Informations>
</Room>
</Rooms>
</root>
and xsl file
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="<xsl:key name="dates" match="@Date" use="." />
<xsl:template match="/">
<xsl:for-each select="root/Rooms/Room">
<TableID>
<xsl:variable name="vRowInd">
<xsl:number count="Fund" level="any"/>
xsl:variable>
<ID>
<xsl:value-of select="$vRowInd"/>
</ID>
</TableID>
</xsl:for-each>
<Test>
<new>
<xsl:apply-templates select="node()[not(descendant-or-self::Rooms)] | @*"/>
</new>
</Test>
</xsl:template>
<xsl:template match="node()[not(descendant-or-self:
rice)] | @*">
<xsl:apply-templates select="price"/>
</xsl:template>
<xsl:template match="price">
<TableRoom>
<xsl:for-each select="*[count(key('dates',@Date)[1] | ./@Date) = 1]">
<Price>
<ID><!-- how to have ID comming from TableID same ID for each room name-->
<Date>
<xsl:value-of select="@Date"/>
</Date>
<xsl:for-each select="key('dates', @Date)/parent::*">
<xsl:element name="{local-name()}"><xsl:value-of select="."/></xsl:element>
</xsl:for-each>
</Price>
</xsl:for-each>
</TableRoom>
</xsl:template>
</xsl:stylesheet>
Ina
So This is my xml file and I would like to have the same ID in TABLEID and TABLEROOM
<?xml version="1.0"?>
<root>
<Rooms>
<Room>
<RommName>Suite</RommName>
<Informations>
<I>
<Currency>USD</Currency>
<Information>Internet</Information>
</I>
<price>
<A Date="31.01.2005"> 100</A>
<A Date="31.03.2005">411</A>
<A Date="30.09.2005">452</A>
<A Date="31.12.2005">452</A>
<B Date="31.01.2005">462</B>
<B Date="31.03.2005"> 125</B>
<B Date="30.09.2005">350</B>
<B Date="31.12.2005">453</B>
</price>
</Informations>
</Room>
<Room>
<RommName>Suite</RommName>
<Informations>
<I>
<Currency>USD</Currency>
<Information>Internet</Information>
</I>
<price><A Date="31.01.2005"> 115</A>
<A Date="31.03.2005">114</A>
<A Date="28.09.2005">115</A>
<A Date="31.12.2005">156</A>
<B Date="31.01.2005">456</B>
<B Date="31.03.2005"> 245</B>
<B Date="30.09.2005">250</B>
<B Date="25.12.2005">454</B>
</price>
</Informations>
</Room>
</Rooms>
</root>
and xsl file
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="<xsl:key name="dates" match="@Date" use="." />
<xsl:template match="/">
<xsl:for-each select="root/Rooms/Room">
<TableID>
<xsl:variable name="vRowInd">
<xsl:number count="Fund" level="any"/>
xsl:variable>
<ID>
<xsl:value-of select="$vRowInd"/>
</ID>
</TableID>
</xsl:for-each>
<Test>
<new>
<xsl:apply-templates select="node()[not(descendant-or-self::Rooms)] | @*"/>
</new>
</Test>
</xsl:template>
<xsl:template match="node()[not(descendant-or-self:
<xsl:apply-templates select="price"/>
</xsl:template>
<xsl:template match="price">
<TableRoom>
<xsl:for-each select="*[count(key('dates',@Date)[1] | ./@Date) = 1]">
<Price>
<ID><!-- how to have ID comming from TableID same ID for each room name-->
<Date>
<xsl:value-of select="@Date"/>
</Date>
<xsl:for-each select="key('dates', @Date)/parent::*">
<xsl:element name="{local-name()}"><xsl:value-of select="."/></xsl:element>
</xsl:for-each>
</Price>
</xsl:for-each>
</TableRoom>
</xsl:template>
</xsl:stylesheet>
Ina