|
No problem. Check out w3schools[^] for a pretty decent xpath tutorial.
Logifusion[^]
If not entertaining, write your Congressman.
|
|
|
|
|
Hello ,
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
|
|
|
|
|
What I am trying to do it is a tri-dimensional table to be exact. I would like after be able to import this data into ms access. I need to find a way to group by id and date. any idea how to do that in xsl.
Ina
|
|
|
|
|
Hello,
I am a fresher to VC++. i have to connect to a system using webservice in VC++, the protocol used is SOAP. and i have to retieve some data from that system. can any one help me in this.
Ajith
|
|
|
|
|
Hi All,
I want to insert a page-sequence for every 5 table rows.
Here is what i have thus far...
<xsl:variable name="STOP" select="5"/>
<xsl:for-each select="TablePop/TableInfo[position() mod $STOP = 1]">
<fo:page-sequence master-reference="simple" initial-page-number="auto">
<fo:flow flow-name="xsl-region-body">
<fo:table table-layout="fixed" width="750pt">
<fo:table-column column-width="200pt"/>
<fo:table-column column-width="275pt"/>
<fo:table-column column-width="275pt"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block text-align="left" font-size="10pt" font-family="Courier">
Title1
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block text-align="left" font-size="10pt" font-family="Courier">
Title2
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block text-align="left" font-size="10pt" font-family="Courier">
Title3
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
<xsl:for-each select=".|following-sibling::TablePop/TableInfo[position() < $STOP]">
<xsl:apply-templates select="."/>
</xsl:for-each>
</fo:flow>
</fo:page-sequence>
</xsl:for-each>
here is the later bit...
<xsl:template match="TablePop">
<fo:table table-layout="fixed" width="750pt">
<fo:table-column column-width="200pt"/>
<fo:table-column column-width="275pt"/>
<fo:table-column column-width="275pt"/>
<fo:table-body>
<xsl:for-each select="TableInfo">
<fo:table-row>
<fo:table-cell font-size="7pt" border="1" border-color="black" border-style="solid" padding="2pt">
<fo:block>
<xsl:value-of select="ClientTitle"/>
</fo:block>
</fo:table-cell>
<fo:table-cell font-size="7pt" border="1" border-color="black" border-style="solid" padding="2pt">
<fo:block>
<xsl:value-of select="ClientName"/>
</fo:block>
</fo:table-cell>
<fo:table-cell font-size="7pt" border="1" border-color="black" border-style="solid" padding="2pt">
<fo:block>
<xsl:value-of select="ClientSurname"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
</fo:table-body>
</fo:table>
</xsl:template>
I can display the titles: Title1 Title2 Title3
each one of these titles are on a seperate page, That is Fine. Now i can't get the data to display underneath the Title1 Title2 Title3.
example
Title1--Title2--Title3
mr John White
mrs Sam Blue
prof Ed Black
He who laughs last...
|
|
|
|
|
Here is the part that contains the xml where the data is that i need to display
<TablePop>
<TableInfo Key="0">
<ClientName>Estelle</ClientName>
<ClientSurname>Van Graan</ClientSurname>
</TableInfo>
<TableInfo Key="1">
<ClientTitle>Mr</ClientTitle>
<ClientName>Natalie</ClientName>
<ClientSurname>Liebenberg</ClientSurname>
</TableInfo>
<TableInfo Key="2">
<ClientTitle>Mr</ClientTitle>
<ClientName>Irma</ClientName>
<ClientSurname>Du Plessis</ClientSurname>
</TableInfo>
<TableInfo Key="3">
<ClientTitle>Mr</ClientTitle>
<ClientName>Sandra</ClientName>
<ClientSurname>Nortje</ClientSurname>
</TableInfo>
<TableInfo Key="4">
<ClientTitle>Mr</ClientTitle>
<ClientName>Sandra</ClientName>
<ClientSurname>Nortye</ClientSurname>
</TableInfo>
<TableInfo Key="5">
<ClientTitle>Mr</ClientTitle>
<ClientName>Kathy</ClientName>
<ClientSurname>Ferreira</ClientSurname>
</TableInfo>
<TableInfo Key="6">
<ClientTitle>Mr</ClientTitle>
<ClientName>Antionette</ClientName>
<ClientSurname>Viloene</ClientSurname>
</TableInfo>
<TableInfo Key="7">
<ClientTitle>Mr</ClientTitle>
<ClientName>Lindsay</ClientName>
<ClientSurname>Scot</ClientSurname>
</TableInfo>
<TableInfo Key="8">
<ClientTitle>Mr</ClientTitle>
<ClientName>Waynand</ClientName>
<ClientSurname>Wessels</ClientSurname>
</TableInfo>
<TableInfo Key="9">
<ClientTitle>Mr</ClientTitle>
<ClientName>Anja</ClientName>
<ClientSurname>Eggers</ClientSurname>
</TableInfo>
<TableInfo Key="10">
<ClientTitle>Miss</ClientTitle>
<ClientName>Susca</ClientName>
<ClientSurname>Watts</ClientSurname>
</TableInfo>
<TableInfo Key="11">
<ClientTitle>Prof</ClientTitle>
<ClientName>Elsabe</ClientName>
<ClientSurname>Van Zyl</ClientSurname>
</TableInfo>
</TablePop>
He who laughs last...
|
|
|
|
|
The part where i put
<xsl:for-each select=".|following-sibling::TablePop/TableInfo[position() < $STOP]">
<xsl:apply-templates select="."/>
</xsl:for-each>
I don't thing that the Template TablePop actualy gets applied. How do i go about it. Any help would be greatly appreciated.
Thank you in advance...
He who laughs last...
|
|
|
|
|
Thank you anyway, i found the answer myself. It was hard but i did it. If any one needs an example, i have one
He who laughs last...
|
|
|
|
|
I'm sorry closest forum on this topic.
<br />
fo:region-body padding-top="2in" padding-bottom=".5in" column-count="2" column-gap="10pt"<br />
At first when I started testing with this the columns were constructed fill the left first then the right but now that I'm using live data (Murphy's law ) it's filling the columns by alternating the data right then left right then left etc.....
I want it to fill left side first and when that is full go to the right side and fill it.
ANY HELP would be appricated.
|
|
|
|
|
Could you modify your post to either ignore HTML tags or replace each < with a < and > with a >? All that can be seen of your XML is this:
fo:region-body padding-top="2in" padding-bottom=".5in" column-count="2" column-gap="10pt"
Logifusion[^]
|
|
|
|
|
I'm sorry but that's all I posted. Is there other code your looking for?
I also failed to mention I don't use the FO alot, so.....
|
|
|
|
|
Can you post a little more of your xsl file? I'm also new to fo but maby i can help...
He who laughs last...
|
|
|
|
|
Links to xsl and sample screen shot [^][^]
|
|
|
|
|
Hi,
I have recently been thrown in the deep end with XML programming and need help. I am developing a web-site for my ISP and need to intergrate the XML functionality my down-stream provider has. At the moment I am able to send a request and get a response ok but I can't for the life of me figure out how to parse the response:
<form method="post" action="https://www.downstreamserver/xmlrequest.php" >
<%Response.Write("<input type=""hidden"" name=""xmlrequest"" value=""" & strXML & """>")%>
<input type="submit" name="submit" value="submit">
</form>
When the Submit button is pressed I get an XML page from the server which is being displayed in my browser. I want to use the information in the XML and place into a table on the page. I apologise for being such a newbie but I really need help with this.
James Boag. Genius
|
|
|
|
|
It took me a while but I figured it out. Had to use a combination of Web Request and XMLTextReader (See MSDN).
James Boag. Genius
|
|
|
|
|
Hi all,
I'm trying to use the xsd.exe to generate some c# classes. I don't have a problem with creating the classes, however, they are all generated in the same file. My question is, can I set the tool so that it creates these classes in separate .cs files or is there another freely available tool that can do the same thing.
thanks in advance guys.
rich
|
|
|
|
|
... or is there a tool around that will parse the .cs file for classes and create separate files. I don't how easy it is to do this but wouldn't feel conficent of doing it mysel.
|
|
|
|
|
I have an XML file which will contain the color of Table Cell.. i-e Blue,Green,Red depending upon the values. Is there any way to assign back-ground color of cell from these vales ????
I have tried variable and direct but in vain.the error comes when I write this
'@AIV = Variable which contains red,green or yellow
<fo:table-cell background-color="@AIV">
or
<fo:table-cell background-color='<xsl:value-of select="@AIV" />'>
Any Solution would be highly appreciated
-- modified at 6:58 Wednesday 26th July, 2006
|
|
|
|
|
The problem is that I do not have any files. The XML I have stored in a variable (string or XmlDocument). And the second problem is that I need to return string that contains HTML.
|
|
|
|
|
|
I don't know how to do this in C#.
|
|
|
|
|
Don't know how to do what? You say you've got an XML stored in a string or an XmlDocument and you want to transform it to HTML. Do you have a stylesheet? Do you have to parse it with C# code? Do you have to handle both strings and XmlDocuments? Have you written any code yet? What does it do?
In order for someone to be able to help you, you have to explicitly spell out what you need help on. We can't read your mind.
Logifusion[^]
|
|
|
|
|
Ok, I have to build function in C# with next functionality:
1. The function must get two parameters: first is a string that holds xml, second is a string that holds a path to the XLS file.
2. The function must transform XML to HTML (according to XLS) and return it as a string.
That's all!
|
|
|
|
|
Use System.Xml.Xsl.XslCompiledTransform :
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load("output.xsl");
That loads the XSL. Now you have to perform the transformation using the Transform method. You'll have to pass it an XmlReader and XmlWriter since you start and end with a string.
XmlReader xr = new XmlReader(new StringReader(myInputString));
StringBuilder sb = new StringBuilder();
XmlTextWriter xtw = new XmlTextWriter(new StringWriter(sb));
xslt.Transform(xr, xtw);
return sb.ToString();
Logifusion[^]
|
|
|
|
|
Thank you very much!
P.S.
I changed
XmlReader xr = new XmlReader(new StringReader(myInputString));
to
XmlReader xr = XmlReader.Create(new StringReader(myInputString));
And thank you again!
|
|
|
|