RE: PHP and XML

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks, I'm investigating XSL and it looks pretty good.  We use an RPM based
installation of PHP version 5.0.4.  I see on PHP.net's website that XSL
comes standard with PHP 5 and you need to enable it by adding the argument
--with-xsl to the configure line.  How do I do this when we did not build
PHP from source?  Is there another way to get XSL activated?

Thanks for your help
Robbert 

-----Original Message-----
From: Stephen Leaf [mailto:smileaf@xxxxxxxxxxx] 
Sent: Wednesday, October 05, 2005 7:39 PM
To: php-general@xxxxxxxxxxxxx
Subject: Re:  PHP and XML

On Wednesday 05 October 2005 06:20 pm, php@xxxxxxxxxxxx wrote:
> My company recently installed google's search appliance and I am working
> on some scripts to display the search results on our various websites.
> The problem I'm having is using the XML parsing functions I've used on
> other pages is not working because the returned XML has invalid xml
> characters in it.  For example, the data between the xml tags include
> html tags that are supposed to be displayed.  But when I parse the xml,
> the parse sees these tags as new start tags.  Is there a way to work
> around this or a different way to parse this document?  I've heard a
> little about XSLT really don't know anything about it and am wondering
> if that is the way to deal with it?
XSL can display the contents using a 
<xsl:copy-of select="node"/>
bear in mind tho that it also copies the node name.
example:
<node>copied stuff<br/></node>

copying only the inner content can be achieved by doing a select="." however

you'll need to have the current node be the one that you want copied.
this can be done by using a
<xsl:for-each select="node">
<xsl:copy-of select="."/>
</xsl:for-each>

If anyone else knows of a better way _please_ let me know :)

When working with XML and going to HTML .. IMO XSL is the best way to 
accomplish it.

>
> Here is a part of the XML returned by the google appliance:
> <GSP VER="3.2">
> <TM>0.008398</TM>
> <Q>information services</Q>
> <PARAM name="q" value="information services"
> original_value="information+services"/>
> <PARAM name="site" value="shpolicy" original_value="shpolicy"/>
> <PARAM name="client" value="shpolicy" original_value="shpolicy"/>
> <PARAM name="output" value="xml_no_dtd" original_value="xml_no_dtd"/>
> <PARAM name="btnG" value="Google_Search"
> original_value="Google+Search"/>
> <PARAM name="ip" value="10.2.4.44" original_value="10.2.4.44"/>
> <PARAM name="access" value="p" original_value="p"/>
> -
> 	<RES SN="1" EN="10">
> <M>86</M>
> <FI/>
> -
> 	<NB>
> -
> 	<NU>
>
/search?q=information+services&site=shpolicy&hl=en&output=xml_no_dtd&client
>=shpolicy&access=p&sort=date:D:L:d1&start=10&sa=N </NU>
> </NB>
> -
> 	<R N="1" MIME="application/pdf">
> -
> 	<U>
>
http://shpolicy.shservices.org/administrative/InformationServices/housewide
>applicable/Information%20Services%20Software%20Purchasing%20Policy.pdf </U>
> -
> 	<UE>
>
http://shpolicy.shservices.org/administrative/InformationServices/housewide
>applicable/Information%2520Services%2520Software%2520Purchasing%2520Policy.
p
>df </UE>
> -
> 	<T>
> <b>Information</b> <b>Services</b> Software Purchasing
> </T>
> <RK>5</RK>
> <FS NAME="date" VALUE="2005-09-07"/>
> -
> 	<S>
>  <b>...</b> Administrative Housewide Policy <b>Information</b>
> <b>Services</b> Software Purchasing Applicable<br> Campus: Salem and
> West Valley Hospitals Department Name: <b>Information</b> <b>...</b>
> </S>
> -
> 	<HAS>
> <L/>
> <C SZ="" CID="4_wracnOVC8:"/>
> </HAS>
> </R>
>
> I can send the parsing code but it's fairly straight forward and I
> didn't want to needlessly fill up the email.
>
> Any suggestions?
>
> Thanks,
> Robbert van Andel

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux