rachelkruzner
Programmer
I have the following XML:
<items>
<item number="100">
<subitems attr1=..., attr2=....>
<subitem subitemid="201x"></subitem>
<subitem subitemid="202x"></subitem>
<subitems>
...
</items>
<orders>
<order number=882, itemnum="100", subitemid="202x">
<level1>1</level1>
<level1>2</level1>
...
</order>
</orders>
During processing of <orders> element, I'm using an apply-templates to process some data under Items/subitems/subitem element.
apply-templates select="key('subitem', "100"
/Subitems/Subitem[@subitemid="202x"]
key is defined as:
<xsl:key name="subitem" match="//Items/Item" use="@number"/>
I expect the apply-templates to only pick up the <subitem> for 202x; however it actually picked up both subitems even though I've specified a matching attribute value.
How can keep the current context in <orders> element and yet able to branch out to process a single node or multiples of a given element somewhere else in the same document?
Thanks in advance
Rachel
<items>
<item number="100">
<subitems attr1=..., attr2=....>
<subitem subitemid="201x"></subitem>
<subitem subitemid="202x"></subitem>
<subitems>
...
</items>
<orders>
<order number=882, itemnum="100", subitemid="202x">
<level1>1</level1>
<level1>2</level1>
...
</order>
</orders>
During processing of <orders> element, I'm using an apply-templates to process some data under Items/subitems/subitem element.
apply-templates select="key('subitem', "100"
key is defined as:
<xsl:key name="subitem" match="//Items/Item" use="@number"/>
I expect the apply-templates to only pick up the <subitem> for 202x; however it actually picked up both subitems even though I've specified a matching attribute value.
How can keep the current context in <orders> element and yet able to branch out to process a single node or multiples of a given element somewhere else in the same document?
Thanks in advance
Rachel