Click here to Skip to main content
15,920,005 members
Home / Discussions / XML / XSL
   

XML / XSL

 
Questionweb service connection error. Pin
Goodway31-Jul-06 2:06
Goodway31-Jul-06 2:06 
QuestionDesigning a GUI Pin
_AnsHUMAN_ 30-Jul-06 19:50
_AnsHUMAN_ 30-Jul-06 19:50 
QuestionImplementing XSLT in end-user document [modified] Pin
R. A. Abbasi28-Jul-06 23:32
R. A. Abbasi28-Jul-06 23:32 
QuestionHow to display repiting information Pin
somniatorum28-Jul-06 5:22
somniatorum28-Jul-06 5:22 
AnswerRe: How to display repiting information Pin
Dustin Metzgar28-Jul-06 5:44
Dustin Metzgar28-Jul-06 5:44 
GeneralRe: How to display repiting information Pin
somniatorum28-Jul-06 6:21
somniatorum28-Jul-06 6:21 
GeneralRe: How to display repiting information Pin
Dustin Metzgar28-Jul-06 6:30
Dustin Metzgar28-Jul-06 6:30 
QuestionBI dimensional table in XSL - Suggestions Pin
inarobis28-Jul-06 4:31
inarobis28-Jul-06 4:31 
Hello Smile | :) ,

I am very new in XSL and I would like to know if someone can help me in that trick, at least give me some advice on how to that:

so i have this sample xml: (Sorry for this long post)

<?xml version="1.0"?>
<root>

<Rooms>

<Room>
<RommName>Suite</RommName>
<Informations>
<I>
<Currency>USD</Currency>
<Information>Internet</Information>
</I>
<price>
<A Date="31.07.2005"> 100</A>
<A Date="31.08.2005">411</A>
<A Date="30.09.2005">452</A>
<A Date="31.10.2005">452</A>
<B Date="31.07.2005">462</B>
<B Date="31.08.2005"> 125</B>
<B Date="30.09.2005">350</B>

</price>
</Informations>
</Room>
<Room>
<RommName>Little Suite</RommName>
<Informations>
<I>
<Currency>USD</Currency>
<Information>Internet</Information>
</I>
<price>
<A Date="30.04.2005"> 115</A>
<A Date="31.05.2005"> 115</A>
<A Date="30.06.2005"> 115</A>
<A Date="31.07.2005"> 115</A>
<A Date="31.08.2005">114</A>
<A Date="30.09.2005">115</A>
<B Date="31.08.2005">456</B>
<B Date="30.09.2005">456</B>
<B Date="31.10.2005"> 245</B>
<B Date="30.11.2005">250</B>
<B Date="31.12.2005">454</B>

</price>
</Informations>
</Room>

<Room>
<RommName>Suite 3</RommName>
<Informations>
<I>
<Currency>USD</Currency>
<Information>Internet</Information>
</I>
<price>
<A Date="31.12.2005"> 100</A>

</price>
</Informations>
</Room>
</Rooms>

</root>

and I would like to, according to ID of each room and accordance to each date of this ID I would to have the price of A and B. Maybe have two keys ???

<code><?xml version='1.0' ?>
<TEST>
<TableID>
<ID>1</ID>
<roomName>Suite</roomName>
<TableRoom>
<Date>31.07.2005</Date>
<ID>1</ID>
<A> 100</A>
<B>462</B>
</TableRoom>
<TableRoom>
<Date>31.08.2005</Date>
<ID>1</ID>
<A>411</A>
<B> 125</B>
</TableRoom>
<TableRoom>
<Date>30.09.2005</Date>
<ID>1</ID>
<A>452</A>
<B>350</B>
</TableRoom>
<TableRoom>
<Date>31.10.2005</Date>
<ID>1</ID>
<A>452</A>
</TableRoom>
</TableID>
...
this is my xsl code

<code><?xml version='1.0' ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:key name="roomName" match="root/Rooms/Room/RoomName" use="generate-id()"/>
<xsl:key name="dates" match="@Date" use="."/>
<xsl:key name="id" match="root/Rooms/Room" use="generate-id()"/>
<xsl:template match="/">
<TEST>
<xsl:for-each select="root/Rooms/Room">
<TableID>
<xsl:apply-templates select="root/Rooms/Room"/>
<xsl:variable name="vRowInd">
<xsl:number count="Room" level="any"/>
</xsl:variable>
<ID>
<xsl:value-of select="$vRowInd"/>
</ID>
<roomName>
<xsl:value-of select="RommName"/>
</roomName>

<xsl:apply-templates />
</TableID>
</xsl:for-each>

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

<xsl:template match="price">

<xsl:for-each select="*[count(key('roomName',/root/Rooms/Room/roomName)[1] | ./@Date ) = 1 ]">

<TableRoom >

<Date>
<xsl:value-of select="@Date"/>
</Date>
<xsl:variable name="vRowInd">
<xsl:number count="Room" level="any"/>
</xsl:variable>

<ID>
<xsl:value-of select="$vRowInd"/>
</ID>


<xsl:for-each select="@Date/parent::*">

<xsl:element name="{local-name(.)}">
<xsl:value-of select="."/>

</xsl:element>
</xsl:for-each>
</TableRoom>
</xsl:for-each>

</xsl:template>

</xsl:stylesheet></code>

Ina
AnswerRe: BI dimensional table in XSL - Suggestions Pin
inarobis31-Jul-06 0:03
inarobis31-Jul-06 0:03 
Questionconnect to web service using VC++ Pin
Ajith Sivakumar28-Jul-06 2:27
Ajith Sivakumar28-Jul-06 2:27 
QuestionPage sequences in fop continue Pin
Support12327-Jul-06 21:58
Support12327-Jul-06 21:58 
QuestionRe: Page sequences in fop continue XML Pin
Support12327-Jul-06 22:00
Support12327-Jul-06 22:00 
QuestionRe: Think i found the problem, but don't know how to fix it Pin
Support12328-Jul-06 1:43
Support12328-Jul-06 1:43 
AnswerThank you anyway Pin
Support12328-Jul-06 2:52
Support12328-Jul-06 2:52 
QuestionFO Question Pin
Are Jay27-Jul-06 9:57
Are Jay27-Jul-06 9:57 
AnswerRe: FO Question Pin
Dustin Metzgar27-Jul-06 10:12
Dustin Metzgar27-Jul-06 10:12 
GeneralRe: FO Question Pin
Are Jay27-Jul-06 11:03
Are Jay27-Jul-06 11:03 
GeneralRe: FO Question Pin
Support12327-Jul-06 21:45
Support12327-Jul-06 21:45 
GeneralRe: FO Question Pin
Are Jay28-Jul-06 4:46
Are Jay28-Jul-06 4:46 
QuestionParsing XML Server Response Pin
FrancisMH26-Jul-06 20:35
FrancisMH26-Jul-06 20:35 
AnswerRe: Parsing XML Server Response Pin
FrancisMH31-Jul-06 14:16
FrancisMH31-Jul-06 14:16 
QuestionXSD code generation problems! Pin
richiemac26-Jul-06 2:09
richiemac26-Jul-06 2:09 
AnswerRe: XSD code generation problems! Pin
richiemac26-Jul-06 2:12
richiemac26-Jul-06 2:12 
QuestionHow to get back color of table-cell from XML ??? [modified] Pin
Rizwan Bashir26-Jul-06 0:58
Rizwan Bashir26-Jul-06 0:58 
QuestionTrasnsform XML from string Pin
offengenden25-Jul-06 6:20
offengenden25-Jul-06 6:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.