Community-Credit.com | NonProfitWays.com | SOAPitstop.com   Skin:   
      User: Not logged in 
Home
Newsletter Signup
XSLT Library
Latest XML Blogs
Featured Examples
Presentations
Featured Articles
Book Chapters
Training Courses
Events
NewsGroups
 
Discussions
Examples
Tutorials
Tools
Articles
Resources
Websites
 
Sign In
My Profile
My Articles
My Examples
My Favorites
My Resources
Add a Resource
Logout
 
About Me
My Blog
HeadGeek Articles
Talking Portfolio
Resume
Pictures
World Trip Pics

Reply: Using key() and

Date Posted:1/18/2007 7:44 PM
Posted by:
Jason Price
Hi all!

I'm trying to use the key() function together with <xsl:key> element in the following way: I have the input document:
####################################################################
          <A>
             <B>
                <C1 atr1="_10">
                   <D1>name1</D1>
                </C1>
             </B>
          </A>
          ............
          <A>
             <B>
                <C2>
                    <D2>name</D2>
                    <E2>
                       <F2 atr2="_10"/>
                    </E2>
                </C2>
             </B>
          </A>
#####################################################################  

So
when I process this document, when I reach <C2>, I need to
insert  the "name" value that corresponds to the key "_10" from "atr2",
which is the one from "atr1" of tag "C1"; so that would be the name
from <D1>.  

I tried with:
<xsl:key name="id_to_name" match="A/B/C1" use="@atr1"/>
and call it like this:
<xsl:template match="B/C2">
   <myTag>
      <xsl:value-of select="key('id_to_name', @atr2)/D1"/>
   </myTag>
</xsl:template>

but I get no results.

If anybody can help me it would be great.

Best regards,
Fred





Fans of "The Office"
Dwight Bobbleheads are here!
  “It's me! I'm the bobblehead! Yes!”



Advertise on XMLPitstop

Advertise on XMLPitstop


EggHead Cafe
Web Servicee development
DotNetSlackers
Buy links on this site!
internet server backup
Versace sunglasses
Video Surveillance
Web Hosting
Color Laser Printer
Buy links on this site!

Interested in Text ads?
2,277 Total Members
42 members(last 30 days)
13 members(last 7 days)
3 members(today)

1,629 Total Discussions
17 Posts(last 30 days)
2 Posts(last 7 days)
1 Posts(today)

20,047 Total Blog Posts
2,133 Blogs(last 30 days)
573 Blogs(last 7 days)
56 Blogs(today)

8,699 Newsgroup Posts
0 Posts(last 30 days)
0 Posts(last 7 days)
0 Posts(today)

13,802 Total Resources
16 Resources(last 30 days)
1 Resources(last 7 days)
0 Resources(today)


 

David Silverlight's XMLPitstop.com| 2801 Florida Ave #225|Miami, FL 33133|Ph:305-447-1139