using php to process xml/xsl problem
From: Deli (nospam_at_nospam.com)
Date: 01/30/05
- Next message: Janwillem Borleffs: "Re: using php to process xml/xsl problem"
- Previous message: Tree*Rat: "Strip slashes?"
- Next in thread: Janwillem Borleffs: "Re: using php to process xml/xsl problem"
- Reply: Janwillem Borleffs: "Re: using php to process xml/xsl problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 30 Jan 2005 12:08:00 -0000
I am generating XML documents through php 4 and then server side processing
them with an XSL style*** to produce a page. The problem I have however
is with the & when storing long URL strings in the XML. I am expecting
& to be converted into a "&" when producing the final HTML, but instead
it stays as "&", thus making the url invalid. If I change this to a
straight "&" in the XML it obviously produces an XML error as it is invalid
(expected).
As an example The XML is (I've stripped off all the declaration sections):
--------------------------------------
<pageList><num>1</num><link>mailingList.php?start=0&currentLetter=*</link></pageList>
<pageList><num>2</num><link>mailingList.php?start=100&currentLetter=*</link></pageList>
<pageList><num>3</num><link>mailingList.php?start=200&currentLetter=*</link></pageList>
--------------------------------------
The XSL :
--------------------------------------
<a>
<xsl:attribute name="href"><xsl:value-of select="link"/></xsl:attribute>
Test
</a>
--------------------------------------
And the php used to combine
--------------------------------------
function processXML($xml, $xsl)
{
$xml = str_replace("\\0", "", $xml);
$arguments = array('/_xml' => stripslashes($xml), '/_xsl' =>
stripslashes($xsl));
$result = xslt_process($this->parser, 'arg:/_xml', 'arg:/_xsl', NULL,
$arguments);
return $result;
}
--------------------------------------
The final output comes out as
--------------------------------------
<a href="mailingList.php?start=0&currentLetter=*">Test</a>
<a href="mailingList.php?start=100&currentLetter=*">Test</a>
<a href="mailingList.php?start=200&currentLetter=*">Test</a>
--------------------------------------
which is wrong as I was expecting the & to be converted to &
As a test I took the & out of the XML and manually added them into the
XSL, alas it produced the same results.
I am using php on windows if that means anything
If anyone has any ideas they would be apreciated
Thanks
- Next message: Janwillem Borleffs: "Re: using php to process xml/xsl problem"
- Previous message: Tree*Rat: "Strip slashes?"
- Next in thread: Janwillem Borleffs: "Re: using php to process xml/xsl problem"
- Reply: Janwillem Borleffs: "Re: using php to process xml/xsl problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]