|
Subject: Re: [xsl] Conditional XSL Variable From: David Carlisle <davidc@xxxxxxxxx> Date: Thu, 20 Nov 2008 20:13:29 GMT |
Others have pointed out that value-of will produce an epty text node
from a empty element, but most likely you don't want to this at all.
> I think it has something to do with the type of the
> variable, because it is not initialised as a result-tree fragment.
> Has anyone come across this problem before? By the way, I am using
> Saxon-B 9.1.0.3.
There are no result tree fragments in xslt 2 thankfully that has gone.
<xsl:variable name="mappingsCodeA">
If you use value-of inside xsl:variable in thsi way you are not
assigning a string or attribute node to the variable but a document node
with child text node with string value the string value of the selection
which is relatively expensive to build and to use.
You were testing for count=1 but im guessing that you just mean to use
map:entry[@codeA=$valueOfCodeA] if it exists or map:otherwise otherwise
<xsl:variable name="mappingsCodeA" select="$lookupTable/map:table/
(map:entry[@codeA=$valueOfCodeA],/map:otherwise)[1]"/>
Then you can use $mappingsCodeA/@codeB as because you have used a selct
attribute $mappings references the node in your lookup table, not a
document node containing a newly constructed tree.
David
________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs.
________________________________________________________________________
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Conditional XSL Variable, Andrew Welch | Thread | [no subject], Unknown |
| Re: [xsl] Re: Conditional XSL Varia, Darcy Parker | Date | Re: [xsl] Re: Conditional XSL Varia, Andrew Welch |
| Month |