need help on XSLT transformations

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
gowni
Forum Newbie
Posts: 7
Joined: Sat Sep 20, 2003 7:14 am
Contact:

need help on XSLT transformations

Post by gowni »

Hi friends,

i have a xml file whose structure is like as follows:
<ratesfound>
<rate>
<ratetype>3</ratetype>
<node1>3</node1>
<node2>3</node2>
</rate>
<rate>
<ratetype>3</ratetype>
<node1>3</node1>
<node2>3</node2>
</rate>
<rate>
<ratetype>2</ratetype>
<node1>3</node1>
<node2>3</node2>
</rate>
<rate>
<ratetype>1</ratetype>
<node1>3</node1>
<node2>3</node2>
</rate>
<rate>
<ratetype>1</ratetype>
<node1>3</node1>
<node2>3</node2>
</rate>
</ratesfound>

i want to show the three type of rates in three different tables with three different table headers.

can anyone help me?

Thanks in advance
gowni
ihateevilbill
Forum Commoner
Posts: 29
Joined: Fri Nov 14, 2003 5:57 am

Post by ihateevilbill »

not sure if this is a definite answer to what ur looking for but if you check out http://www.w3schools.com/xsl/xsl_w3celementref.asp that will explain how to define XSLT. then if you go to http://www.gingerall.com/charlie/ga/xml ... .xml?s=org there are a few examples of how to use the sablotron extension in php. My advice however would be to use php to load the xml file into avariable then put something like:

Code: Select all

$xsltoutput = '<?xml-stylesheet type="text/xsl" href="yourxsl.xsl"?>' . $result;
echo $xsltoutput;

which will basically concatenate the stylesheet import line with your xsl file.
ihateevilbill
Forum Commoner
Posts: 29
Joined: Fri Nov 14, 2003 5:57 am

Post by ihateevilbill »

Of course you could also try this to attach your xsl to your xml (which is the way I was doing it before Isaw the folly of my ways 8O )

Code: Select all

<?php
$xh = xslt_create();
$res = xslt_process($xh, 'test.xml', 'test.xsl');
xslt_free($xh);
echo $res;
?>
hope this helps
(I realise this doesnt help the XSLT question but my last answer sorts that out hopefully and this should help when you come to actually join the 2 together)
gowni
Forum Newbie
Posts: 7
Joined: Sat Sep 20, 2003 7:14 am
Contact:

I got It

Post by gowni »

thanks Guys for your replies.

I got it.

Gowni
Post Reply