exslt variable?
"Bruno PIERRE" <[email protected]>
| Newsgroups | gmane.text.xml.xslt.extensions |
|---|---|
| Message-ID | <[email protected]> |
Hello everybody,
I'm new in this mailling list, and i am really interested in exslt.
I've seen a lot of functionnality that are a true lack in standard xslt, but there is point that is not evocated.
The lack of functionnality for xsl:variable and xsl:param
When you use xsl you often avoid xsl:for-each by using xsl:template but then, variable are lost.
And i'm forced to use a heavy xsl:with-param at each xsl:apply-templates for each of my variable that i want to acceed later.
But doing this i cant' use xsl:apply-imports, because in these case parameters are lost.
Is it stupid to imagine an "standard" extension that allow to stock a variable and get it when needed (and clean it)
I did a stuff like
<msxsl:script implements-prefix="myprefix" language="JavaScript"><![CDATA[
var xslscontext = Array();
function setcontext(context)
{
xslscontext[xslscontext.length] = context;
return '';
}
function getcontext()
{
return xslscontext[xslscontext.length-1];
}
function clearcontext()
{
xslscontext.pop();
return '';
}
]]></msxsl:script>
and use it like :
<xsl:template match="nodetostock">
<xsl:value-of select="myprefix:setcontext(current())"/>
<xsl:apply-templates select="*"/>
<xsl:value-of select="myprefix:clearcontext()"/>
</xsl:template>
for msxml but i don't know how to do it with other processor.
And i think a component like
<xsl:template match="nodetostock">
<myprefix:setcontext select="current()">
<xsl:apply-templates select="*"/>
</myprefix:setcontext>
</xsl:template>
But i don't have experience with component.
And by this way i only stock 1 variable.
It would be fine to have a standard component (like exslt) to have variable more accessible than in simple xslt
You can find my full xsl at :
http://bouba.no-ip.com/xsl/xslscript/xslscript.xsl
but it is embed in a bigger project wich allow me to put "xsl like tag" in my xml file.
Thanks,
and sorry for my poor english
Bruno PIERRE.