Subject: Re: [xsl] xpath expression restriction From: Michael Kay <mike@xxxxxxxxxxxx> Date: Fri, 04 Mar 2011 08:48:02 +0000 |
Hi Mukul,
It works with the braces. Still I wonder why it did not pick the "if" and evaluate it?
Michael Kay Saxonica
I am not sure if I understand your question right, but
In the example, $cond is only checking for empty (null) or not.
In the code, it is more like
if ($logging or ($logged and string($nxtid))) then 1 else 0
also, abc is a sequence closer to
$data//wf/*
and the idea is simply to not copy the first element, under some condition
also, it is not really an xsl:copy-of, but an xsl:sequence ...
Thank you.
Regards, ac
Hi Andre, I'm not sure, but perhaps writing the whole if condition in braces may force evaluation of the if expression before providing this operand to operator "gt".
i.e could you please try if following works,
<xsl:copy-of select="abc[position() gt (if ($cond) then 1 else 0)]"/>
also curious to know, what do you write to evaluate $cond?
On Fri, Mar 4, 2011 at 11:22 AM, ac<ac@xxxxxxxxxxxxx> wrote:Hi,
There must be a reason why I can write
<xsl:variable name="x" select="if ($cond) then 1 else 0"/> <xsl:copy-of select="abc[position() gt $x]"/>
but not
<xsl:copy-of select="abc[position() gt if ($cond) then 1 else 0]"/>
What is the reason? Is there any way to avoid having to declare the variable?
Thank you,
Regards, Andre
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xpath expression restrict, ac | Thread | Re: [xsl] xpath expression restrict, ac |
Re: [xsl] XSLT3 XPATH3 Books?, Michael Kay | Date | Re: [xsl] xpath expression restrict, ac |
Month |