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

Variable with Namespace

Subject: Variable with Namespace
From: David Natter <David.Natter@xxxxxxxx>
Date: Mon, 23 Oct 2000 15:27:41 -0400
variable in namespace
I am trying to use a variable with a namespace.

As far as I can tell, I should be able to use a variable called <<foo:bar>>
where foo is previously declared namespace prefix.  This would be the fourth
example on page 400 of Michael Kay's book.  According to the book on page 308, a
variable name should be a QNAME, which can have a namespace prefix.

So, I wrote the following test stylesheet:

<xsl:transform
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:foo="http://www.natter.com"
    version="1.0">
<xsl:template match="*">
  <xsl:variable name="foo:var1">46</xsl:variable>
  <xsl:value-of select="$foo:var1"/>
</xsl:template>
</xsl:transform>

but when I try to run it using Xalan, I get the following output:

XSL Error: pattern = '$foo:var1'
Extra illegal tokens: ':', 'var1', style tree node:
org.apache.xalan.xslt.ElemValueOf@b819f
XSL Error: Could not parse Input XSL document!, line 7, offset 37
XSL Error: SAX Exception, line 7, offset 37
pattern = '$foo:var1'
Extra illegal tokens: ':', 'var1'
 at org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1674)
 at
org.apache.xalan.xslt.XSLTEngineImpl.processStylesheet(XSLTEngineImpl.java:738)
 at org.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java:572)
 at XSLTest.main(XSLTest.java:14)

So, am I doing something wrong or are variables not allowed to have a namespace?

Thanks in advance.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.