This is a discussion on How to change output method dynamically? within the PHP Language forums, part of the PHP Programming Forums category; Hi all, I can't find anything about this in the PHP manual or on Google, so I'm hoping ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi all,
I can't find anything about this in the PHP manual or on Google, so I'm hoping you'll be able to help. The situation is that I'm already using plenty of xsl:param elements which are given data from PHP, as such: $arguments['/_xml'] = xslt_process( $xh ,'arg:/_xml' ,'arg:/_xsl' ,NULL ,$arguments ,array( 'method' => xml_entity_encode('html') ,'encoding' => xml_entity_encode('UTF-8') ) ); <xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:param name="method"/> <xsl:param name="encoding"/> Now, I'd like to feed these values to the xsl:output attributes, not in the resulting markup. How can I do that (preferably without another stylesheet)? The following doesn't work in PHP4: <xsl:output method="{$method}" encoding="{$encoding}" /> It just takes the values literally. |
|
|||
|
On Thu, 07 Feb 2008 17:10:19 +0100, l0b0 <victor.engmark@gmail.com> wrote:
> Hi all, > > I can't find anything about this in the PHP manual or on Google, so > I'm hoping you'll be able to help. > > The situation is that I'm already using plenty of xsl:param elements > which are given data from PHP, as such: > > $arguments['/_xml'] = xslt_process( > $xh > ,'arg:/_xml' > ,'arg:/_xsl' > ,NULL > ,$arguments > ,array( > 'method' => > xml_entity_encode('html') > ,'encoding' => > xml_entity_encode('UTF-8') > ) > ); > > <xsl:stylesheet > version="1.0" > xmlns="http://www.w3.org/1999/xhtml" > xmlns:xhtml="http://www.w3.org/1999/xhtml" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > > > <xsl:param name="method"/> > <xsl:param name="encoding"/> > > Now, I'd like to feed these values to the xsl:output attributes, not > in the resulting markup. How can I do that (preferably without another > stylesheet)? The following doesn't work in PHP4: > > <xsl:output > method="{$method}" > encoding="{$encoding}" > /> > > It just takes the values literally. <http://nl2.php.net/manual/en/function.domxsltstylesheet-process.php> ? -- Rik Wasmus |
|
|||
|
On Feb 8, 2:48 am, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> On Thu, 07 Feb 2008 17:10:19 +0100, l0b0 <victor.engm...@gmail.com> wrote: > > Hi all, > > > I can't find anything about this in the PHP manual or on Google, so > > I'm hoping you'll be able to help. > > > The situation is that I'm already using plenty of xsl:param elements > > which are given data from PHP, as such: > > > $arguments['/_xml'] = xslt_process( > > $xh > > ,'arg:/_xml' > > ,'arg:/_xsl' > > ,NULL > > ,$arguments > > ,array( > > 'method' => > > xml_entity_encode('html') > > ,'encoding' => > > xml_entity_encode('UTF-8') > > ) > > ); > > > <xsl:stylesheet > > version="1.0" > > xmlns="http://www.w3.org/1999/xhtml" > > xmlns:xhtml="http://www.w3.org/1999/xhtml" > > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > > > <xsl:param name="method"/> > > <xsl:param name="encoding"/> > > > Now, I'd like to feed these values to the xsl:output attributes, not > > in the resulting markup. How can I do that (preferably without another > > stylesheet)? The following doesn't work in PHP4: > > > <xsl:output > > method="{$method}" > > encoding="{$encoding}" > > /> > > > It just takes the values literally. > > <http://nl2.php.net/manual/en/function.domxsltstylesheet-process.php> > ? Is that different from PHP4's xslt_process()? There are no indications that you can do this in DomXsltStylesheet->process(). |
|
|||
|
On Feb 7, 5:10 pm, l0b0 <victor.engm...@gmail.com> wrote:
> I can't find anything about this in the PHP manual or on Google, so > I'm hoping you'll be able to help. > > The situation is that I'm already using plenty of xsl:param elements > which are given data from PHP, as such: > > $arguments['/_xml'] = xslt_process( > $xh > ,'arg:/_xml' > ,'arg:/_xsl' > ,NULL > ,$arguments > ,array( > 'method' => > xml_entity_encode('html') > ,'encoding' => > xml_entity_encode('UTF-8') > ) > ); > > <xsl:stylesheet > version="1.0" > xmlns="http://www.w3.org/1999/xhtml" > xmlns:xhtml="http://www.w3.org/1999/xhtml" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > > > <xsl:param name="method"/> > <xsl:param name="encoding"/> > > Now, I'd like to feed these values to the xsl:output attributes, not > in the resulting markup. How can I do that (preferably without another > stylesheet)? The following doesn't work in PHP4: > > <xsl:output > method="{$method}" > encoding="{$encoding}" > /> > > It just takes the values literally. I ended up using an extra style sheet to convert XHTML to HTML instead: <http://l0b0.net/blog/?p=109> -- Victor |