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

Stuck on Name() and variable

Subject: Stuck on Name() and variable
From: "Kimberly Hahn" <Kimberly.Hahn@xxxxxxxxxx>
Date: Mon, 5 Aug 2002 15:38:08 -0500
xsl variable name
I am having trouble getting an attribute match on name to work.  I'm sure I
am missing something silly here, so I hope someone will see it and point it
out to me!

I have a process where a mapping node tells me the node I need to read (done
through a function call since it uses bit comparison, this works fine).
Once I know the target node I need to read (either MapKey or MapMD), I then
need to get the attribute from that target node that has the same name as
the attribute I am on in the mapping node.  This is where I am stumped.  The
correct value is in the variable $AttrName, and a node of that name exists
in the target (MapKey or MapMD), but the match, attribute::*[name() =
$AttrName], is not doing what I expected it to do.  I get a result of
'4()(col13)  | ' from the sample output I added to try and figure out what
was going on.  So I can see that I have nothing in the $Pos variable.  But I
do have an attribute 'col13' in the MapMD node.

Can I even do a match on the attribute name against a variable?

<MapMD col0="0" col13="3" col14="2" col15="1" col16="4" col17="5" col18="8"
col19="7" col20="6" col21="9" col22="10"></MapMD>


<xsl:attribute name="data">
  <xsl:variable name="Market" select="node()"/>
  <xsl:variable name="Key" select="parent::node()"/>
  <xsl:for-each select="//Map[@schema]/attribute::*[position() &gt; 2]" >
      <xsl:variable name="AttrName" select="name()"/>
      <xsl:choose>
            <xsl:when test="bitmask:DeCode(current(), 2) " >
                  <xsl:variable name="Pos" >
                         <xsl:value-of select="MapKey/@*[name() =
$AttrName]" />
                  </xsl:variable>
                  2 - (<xsl:value-of select="$Pos" />)(<xsl:value-of
select="$AttrName" />) <xsl:value-of select="$Key/attribute::*[$Pos]" />
            </xsl:when>
            <xsl:when test="bitmask:DeCode(current(), 4) " >
                  <xsl:variable name="Pos" >
                        <xsl:value-of select="MapMD/attribute::*[name() =
$AttrName]" />
                  </xsl:variable>
                  4(<xsl:value-of select="$Pos" />)(<xsl:value-of
select="$AttrName" />) <xsl:value-of select="$Market/attribute::*[position()
= $Pos]" />
            </xsl:when>
      </xsl:choose>
      <xsl:if test = "position() != last()"> | </xsl:if>
   </xsl:for-each>
</xsl:attribute>



 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.