xsl-list
[Top] [All Lists]

Re: [xsl] Conditional XSL Variable

2008-11-20 15:13:55

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[(_at_)codeA=$valueOfCodeA] if it exists or map:otherwise otherwise 

 <xsl:variable name="mappingsCodeA" select="$lookupTable/map:table/
(map:entry[(_at_)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. 
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--