| Subject: [xsl] Namespace and XSL Variables From: <Trish@xxxxxxxxxxxxxx> Date: Tue, 12 Sep 2006 10:15:13 -0400 | 
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 | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| Re: [xsl] Conditional Totalling, jeb501 | Thread | Re: [xsl] Namespace and XSL Variabl, David Carlisle | 
| Re: [xsl] looping in increments, Vijay Malgari | Date | Re: [xsl] Namespace and XSL Variabl, David Carlisle | 
| Month |