Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

How to check from Key

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Everybody,
Could anyone give me clue for this issue. I have a tag XML like this:
<Match>
<TemplateNode ID="1">
<Attr ID="1" Display="Table" />
<Attr ID="2" Display="Plot" />
</TemplateNode>
<TemplateNode ID="2">
<Attr ID="1" Display="Table" />
</TemplateNode>
</Match>
<Document TemplateNodeID="1">
<Item>
<Attr ID="1" />
<Attr ID="2" />
<Attr ID="3" />
</Item>
</Document>
<Document>
<Item TemplateNodeID="2">There is XML for Table
inside this tag</Item>
</Document>
There are multiple documents in the same XML and
program outputs the tables whose IDs match with the
ones given inside <TemplateNode ID="15"> and also the
IDs of the attributes in that table should match with
the ID given in <Attr ID="1" Display="Table" /> but at
the same time program has to check if the
@Display='Table' then display that attribute inside
Table otherwise plot a graph for this particular
attribute.
Now since I'm using key to match the IDs but when I
try to use keys for Display also if the program finds
Display anywhere inside any tag it applies this key
for every condition. My question is how do I check
that if Display='Table' or Display='Plot' for that
particular Attr ID when looping is undergoing.
<xsl:for-each select="Attr[key('AttrID', @ID) and
key('Display', 'Table')]/Value">
The above way doesn't help.
Thanks
 
Stop it! You're embarassing me! And you are embarrassing this tiny ad!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic