[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Conditional XSL Variable

Subject: Re: Conditional XSL Variable
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 20 Nov 2008 20:13:29 GMT
Re:  Conditional XSL Variable
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

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/

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.


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


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.