Subject: Re: [xsl] push-pull From: ac <ac@xxxxxxxxxxxxx> Date: Wed, 19 Mar 2008 13:33:46 -0400 |
Using something like you suggested or like this: <xsl:template name="abc"> <xsl:param name="target" select="."/> <xsl:message> <xsl:for-each select="$target"> <xsl:copy-of select="."/> </xsl:for-each></xsl:message> </xsl:template> Still fails if the context item is not set, prior to invocation.
Cheers, ac
Why error "The context item is not set", when the context is not set, on something like this:
<xsl:value-of select="if (.) then 'a' else 'b'"/> How else does one check if the context item is set?
There's no way to test whether the context item is currently set. I think the only case where you can't tell statically is probably within a named template. I think it's probably good practice for a named template to declare a parameter:
<xsl:param name="target" select="."/>
and within the body of the template to refer to $target rather than ".". The caller must then either pass over a context item, or set the value of $target explicitly.
Michael Kay http://www.saxonica.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] push-pull, David Carlisle | Thread | [xsl] Graph processing, Ken Tam |
Re: [xsl] concatinating a varying n, Vyacheslav Sedov | Date | [xsl] And I'd like that in triplica, Ferry, Jeremy |
Month |