Re: [xslt] needed:set xslt variable in program



Tom,

Upon re-reading your original posting it would seem that a parameter is not what you want, and that the document() function or an extension would be the way to go. Since you have already built these documents in-memory as xmlDocPtr's, then I'd say an extension function is needed to access them.

Parameters allow you to pass in an atomic value (a string, a number or a nodeset). libxslt has the neat feature that you can pass an XPath and resolve it to a nodeset, but that would consist of nodes from the source document, not an externally-derived "snippet".

Cheers,
Steve

On 15/06/2006, at 11:56 AM, Tom Stanley wrote:

can we set an xmlNodePtr in memory as a parameter?

--- Steve Ball <Steve Ball explain com au> wrote:

Hi Tom,

Why not simply pass in the value as a stylesheet
parameter?  libxslt
certainly has functions/data structures to pass
parameters; RTFM.

HTHs,
Steve Ball

On 15/06/2006, at 12:10 AM, Tom Stanley wrote:

hello, guys
we plan to use libxml and libxslt  in our
projects.
what we need are like snippet belows:
            <ActivityInput>
                <body>
                    <pfx:field>
                        <pfx:name>
                            <xsl:value-of
select="&quot;Data&quot;"/>
                        </pfx:name>
                        <pfx:id>
                            <xsl:value-of
select="0"/>
                        </pfx:id>
                        <pfx:simple>
                            <xsl:value-of
select="string($var/Report/Data[1])"/>
                        </pfx:simple>
                    </pfx:field>
	 </body>
            </ActivityInput>
We want to use something like  xslt template to
produce some xml tree as process's input.
We can change this xml snippet to a xslt template
and
use applystylesheet to produce expected output xml
tree.
However, we need to set a variable (named var ) in
program before apply the translation.
Does libxslt have any method to do this ,for
example
like xmlXPathRegisterVariable in libxml?

or any other thoughts?

thx


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam
protection around
http://mail.yahoo.com
_______________________________________________
xslt mailing list, project page
http://xmlsoft.org/XSLT/
xslt gnome org
http://mail.gnome.org/mailman/listinfo/xslt


_______________________________________________
xslt mailing list, project page
http://xmlsoft.org/XSLT/
xslt gnome org
http://mail.gnome.org/mailman/listinfo/xslt



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com





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