FW: [xslt] Passing xml expressions as parameters.



To put it another way, consider the following transform on the same data:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0"
 xmlns:exslt="http://exslt.org/common"; extension-element-prefixes="exslt">

  <xsl:param name="maConfig"/>

<xsl:variable name="globalVariable"><lmno>LMNO</lmno></xsl:variable>

  <xsl:template match="/">
    <xsl:copy-of select="." />
    <xsl:value-of select="exslt:node-set($maConfig)/abcd" />
    <xsl:value-of select="exslt:node-set($globalVariable)/lmno" />
  </xsl:template>

</xsl:stylesheet>

It produces the following output:

<?xml version="1.0"?>
<state sequence="0"><info/><action
name="start"/><result><shellArgs/></result><notify/></state>
LMNO

What I would like is for the parameter to be treated the same way as the
global <xsl:variable>

Bob Stobie
bstobie axsone com

-----Original Message-----
From: xslt-bounces gnome org [mailto:xslt-bounces gnome org]On Behalf Of
Daniel Veillard
Sent: Wednesday, July 07, 2004 3:53 PM
To: bstobie www1 yorvik com; The Gnome XSLT library mailing-list
Subject: Re: [xslt] Passing xml expressions as parameters.


On Wed, Jul 07, 2004 at 10:45:38AM -0400, Bob Stobie wrote:
> Basically, is this a feature?  If so, is there anything I can do to
disable
> this?

  You are generating XML. That XML has text with <, > in it. As a result the
XML serializer output them as &lt; and &gt;. This has nothing to do with
XSLT it's just the normal XML serialization rules.

[...]
> The parameter I pass in is
>
> 		<abcd>ABCD</abcd>
[..]
> >From Perl, printing out the result of the translation I get
>
> 		<?xml version="1.0"?>
> 		<state sequence="0"><info/><action
> name="start"/><result><shellArgs/></result><notify/></state>
> 		&lt;abcd&gt;ABCD&lt;/abcd&gt;
>
> Any suggestions would be much appreciated.

  Except changing your stylesheet to disable output escaping of
those fragment in the output, I don't see how to get what you want.

Daniel

--
Daniel Veillard      | Red Hat Desktop team http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
_______________________________________________
xslt mailing list, project page http://xmlsoft.org/XSLT/
xslt gnome org
http://mail.gnome.org/mailman/listinfo/xslt



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