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

Setting variable to namespace prefix

Subject: Setting variable to namespace prefix
From: <sthomas2@xxxxxxx>
Date: Tue, 30 Jan 2007 16:37:57 -0500
 Setting variable to namespace prefix
Apologies in advance for what's certainly a rookie question, but I guess
I've got to start somewhere. I'm trying to assign an xsl:variable to the
value of the namespace prefix for current context (using <oXygen/> with
Saxon6.5.5)

For example, I have the XML fragment:

<xsd:schema xmlns:common="http://[url]"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://[url]"
            elementFormDefault="qualified">
  <xsd:complexType name="name"/>
</xsd:schema>

Where [url] is the same value in both cases.

I would expect the following to set the ns-prefix variable to "common"

<xsl:variable name="ns-prefix">
  <xsl:for-each select="namespace::node()">
    <xsl:if test="(.)=(../../@targetNamespage)">
      <xsl:value-of select="name(.)"/>
    </xsl:if>
  </xsl:for-each>
</xsl:variable>

I can step through the transformation in <oXygen/> and verify that the
test is true and name(.) contains the value "common", but (probably for
some really dumb reason that I'm just missing) the variable isn't being
set.

Help is appreciated.

TIA, Stephen

P.S. Extra apologies if the answer to this question is in the FAQ or the
archives. I suspect it is, but I'm just not recognizing it.

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.