Page 1 of 1

need help on XSLT transformations

Posted: Wed Nov 19, 2003 5:41 am
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

Posted: Thu Nov 20, 2003 3:06 am
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.

Posted: Thu Nov 20, 2003 3:14 am
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)

I got It

Posted: Fri Nov 28, 2003 3:07 am
by gowni
thanks Guys for your replies.

I got it.

Gowni