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

Namespace and XSL Variables

Subject: Namespace and XSL Variables
From: <Trish@xxxxxxxxxxxxxx>
Date: Tue, 12 Sep 2006 10:15:13 -0400
xsl variables
Hi:

I have an xml stream that is formed from three different xml sources
(Source1, Source2, Source3) and then folded into a single xml stream.
The single xml stream has this structure:

<Document>
     <Source1>
          ...
     </Source1>
     <Source2 xmlns:"http://www.somenonexistenturl.com">
          <Results selected="123">
               <Path cp="123">blah blah blah</Path>
               <Path cp="124">la dee da</Path>
               <Path cp="125">ha</Path>
          </Results>
     </Source2>
     <Source3>
          ...
     </Source3>
</Document>

I'm using xsl to create a web page. I pull data from the three 'Source'
elements randomly throughout the stylesheet:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:x="http://www.somenonexistenturl.com">
<xsl:output method="html" indent="no" />
<xsl:template match="/">
     ...
     <xsl:variable name="varResultsId"
select="//x:Source2/x:Results/@x:selected" />
     <xsl:for-each select="//x:Source2/x:Results/x:Path">
          <xsl:choose>
               <xsl:when test="$varResultsId = @cp">
                    do one thing
               </xsl:when>
               <xsl:otherwise>
                    do something else
               </xsl:otherwise>
          </xsl:choose>
     </xsl:for-each>
     ...
</xsl:template>
</xsl:stylesheet>

While I can get the data within the loop with no problem, I cannot seem
to get the xsl:variable to work with the namespace prefixes. Can you
tell me what I'm doing wrong?

Second question: Is there anyway to access the data in Source2 from the
Document node without using "//"?

Thanks!
Trish

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.