xsl-list
[Top] [All Lists]

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

2006-06-06 05:49:43
Hi,

On 6/6/06, tech(_at_)britishexpat(_dot_)com <tech(_at_)britishexpat(_dot_)com> 
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[(_at_)code=$code]/ProductItem" />

and instead of ;

  <xsl:template match="IATA[(_at_)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/ __________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>