This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: text or call-template inside call-template
- To: Daniel Bauke <bonkey at sokrates dot mimuw dot edu dot pl>
- Subject: Re: [xsl] text or call-template inside call-template
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Fri, 15 Jun 2001 19:03:33 +0100
- CC: XSL-List at lists dot mulberrytech dot com
- Organization: Jeni Tennison Consulting Ltd
- References: <20010615190723.A19650@sokrates.mimuw.edu.pl>
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi Daniel,
> oh, yes, it works great. i felt afraid, when i saw jeni's example,
> even more, when i wasn't able to run it in my xalan just as it
> was written ;-) -- yep, i'm a lamer :-). but references looks
> promising.
Oh dear :( If it's too scary and Tom's gave you what you needed, then
ignore this, but just to explain: the templates I gave doesn't run in
Xalan because it uses an extension function. I used the one from the
EXSLT namespace. You have to use the one from the Xalan namespace. You
do that by declaring the Xalan namespace in the xsl:stylesheet
element:
xmlns:xalan="http://xml.apache.org/xalan"
And then replacing exsl:node-set() in the template with
xalan:nodeset() to give:
<xsl:template match="ref">
<xsl:variable name="link-rtf">
<link href="{@id}"> go to ref </link>
</xsl:variable>
<xsl:apply-templates select="xalan:node-set($link-rtf)/*" />
</xsl:template>
> a question -- is there any chance to put text inside call-template
> as it is possible with apply-templates? or better, use call-template
> inside call-template?
You can't put text (well, aside from whitespace) inside
xsl:apply-templates, nor inside xsl:call-template. I'm not sure what
you'd want it to do, but perhaps its to give another parameter value?
You can use xsl:call-template (or anything else!) inside
xsl:with-param:
<xsl:call-template name="a">
<xsl:with-param name="var" select="@some_value" />
<xsl:with-param name="var2">
<xsl:call-template name="b">
<xsl:with-param name="var" select="@some_value" />
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
if that would help?
> and tell the truth -- why all of you are using such terrifing
> language as xslt is? <grin/> don't templates and xml parsers in java
> or even some tree-structured objects are much better, faster,
> simpler and flexible? :-)
Simplicity's in the eye of the beholder ;) I think it's much more
straight forward to query into XML with XPath and build XML with XSLT
than to use the DOM to do it. But each to their own - it's certainly
the case that Java's faster than XSLT and can handle some things
(particular string processing) a lot easier than XSLT can.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list