Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

apply-templates problem

Status
Not open for further replies.

inarobis

IS-IT--Management
Apr 3, 2006
71
CH
Hello guys,

I am newbie and I am blocked in this issue about apply-templates...Could someone give me suggestion how to solve that
xml file

<root>
<Item1>
<Currency>USD</Currency>
<Information>Internet</Information>
</Iteml>

<Rooms>
<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</B>
<B Date="31.01.2005">462</B>
<B Date="31.03.2005"> 125</A>
<B Date="30.09.2005">350</B>
<B Date="31.12.2005">453</B>
</Rooms>

</root>


<xsl:template match="/">
<Test>
<A>
<xsl:apply-templates select="node()[not(descendant-or-self::Rooms)] | @*"/>
</A>

</Test>

</xsl:template>


<xsl:template match="node()[not(descendant-or-self::B)] | @*">
<xsl:apply-templates select="B"/>
</xsl:template>-->


<xsl:template match="Rooms">
Code
</xsl:template>

Ina
 
I just would like to correct my msg Really Sorry

this is the xml

<?xml version="1.0"?>
<root>
<I>
<Currency>USD</Currency>
<Information>Internet</Information>
</I>

<Rooms>
<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>
</Rooms>

</root>



and xsl file

<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="
<xsl:template match="/">

<Test>
<new>
<xsl:apply-templates select="node()[not(descendant-or-self::Rooms)] | @*"/>
</new>

</Test>

</xsl:template>


<xsl:template match="node()[not(descendant-or-self::Rooms)] | @*">
<xsl:apply-templates select="Rooms"/>
</xsl:template>-->


<xsl:template match="Rooms">
it's true
</xsl:template>


</xsl:stylesheet>
 
the problem is that when I try to put a code in

<xsl:template match="Rooms">
<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>
</xsl:template>

I get nothing :(


 
Okay, your amended post xml is well-formed. Just don't get the meaning of the problem.
 
Thank you. I've checked it, I got the answer I solved the problem. :)

Ina
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top