File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes How to check from Key Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "How to check from Key" Watch "How to check from Key" New topic

How to check from Key

Tanya Rawat
Ranch Hand

Joined: Jul 23, 2001
Posts: 31
Hello Everybody,
Could anyone give me clue for this issue. I have a tag XML like this:
<TemplateNode ID="1">
<Attr ID="1" Display="Table" />
<Attr ID="2" Display="Plot" />
<TemplateNode ID="2">
<Attr ID="1" Display="Table" />
<Document TemplateNodeID="1">
<Attr ID="1" />
<Attr ID="2" />
<Attr ID="3" />
<Item TemplateNodeID="2">There is XML for Table
inside this tag</Item>
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
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.
I agree. Here's the link:
subject: How to check from Key
It's not a secret anymore!