Re: [xsl] roblems with passing variables from PHP to XSLT

Subject: Re: [xsl] roblems with passing variables from PHP to XSLT
From: "Alexander Johannesen" <alexander.johannesen@xxxxxxxxx>
Date: Tue, 6 Jun 2006 22:49:24 +1000
Hi,

On 6/6/06, tech@xxxxxxxxxxxxxxxx <tech@xxxxxxxxxxxxxxxx> wrote:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0" xmlns:php="http://php.net/xsl";>

Looks like you haven't got a match for XMLData, the root node, so add ;


<xsl:template match="XMLData">
  <xsl:apply-templates />
</xsl:template>

$domTranObj = $domXsltObj->process( $domXmlObj );

If you want to pass in a parameter as your headline reads, see last comment on this page ;

http://au3.php.net/manual/en/function.domxsltstylesheet-process.php

Also, to tell the XSLT processor that you've got an incoming
parameter, at the top add ;

<xsl:param name="code" />

In your template (in the match='XMLData') you can now do ;

<xsl:apply-template select="IATA[@code=$code]/ProductItem" />

and instead of ;

<xsl:template match="IATA[@code='PEN']/ProductItem">

change your match on your template to simply ;

<xsl:template match="ProductItem">

As to the accuracy of this, I think we need some more info on what
you're trying to do. Your XSLT stylesheet is hopelessly static,
meaning you're trying to match stuff on data you know about, but from
the context of the subject it looks like you want to create a generic
stylesheet, which is what I'm explaining.

Anyways, let me know if any of this made any sense.


Regards,


Alex
--
"Ultimately, all things are known because you want to believe you know."
                                                        - Frank Herbert
__ http://shelter.nu/ __________________________________________________

Current Thread