R
RanDeep
I have two nodes that both exist underneath the root node. They are
linked, however, in the sense that one of the nodes contains a copy of
an id that is used to refer to the other. However, when I try create a
param using this search critieria it can never seem to locate what I
am looking for. For example, check out the following XML file:
-------------------------
<data>
<aBlock id="1">
<tmpdata>
<stringType>Hi</stringType>
</tmpdata>
<reference>
<id>3</id>
</reference>
</aBlock>
<bBlock id="2">
<message>Wrong one</message>
</bBlock>
<bBlock id="3">
<message>Right One</message>
</bBlock>
</data>
-------------------------
with its corresponding stylesheet:
-------------------------
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head><title>Test</title></head>
<body>
Test output:<br/>
<xsl:for-each select="/data/aBlock">
<xsl:apply-templates mode="subData" select="."/>
</xsl:for-each>
</body>
</html>
</xsl:template>
<xsl:template mode="subData" match="aBlock">
<xslaram name="bBlockRef" select="/data/bBlock[@id='2']"/><br />
<xsl:value-of select="./reference"/><br/>
<!-- Problem Statement -->
The Message is: <xsl:value-of
select="/bBlock[@id=./reference]/message"/>
</xsl:template>
</xsl:stylesheet>
-------------------------
The result looks this:
-------------------------
Test output:
3
The Message is:
-------------------------
So the problem is that trying to match the id attribute to a subNode
in the current node isn't working. I don't know if this is because my
syntax is correct (but the preceding value-of expression shows that it
is functional) or if it is because I am trying to perform illegal
behavior in XSL, or what.
But if anyone could help me out- I would be in your debt.
Randeep Walia
linked, however, in the sense that one of the nodes contains a copy of
an id that is used to refer to the other. However, when I try create a
param using this search critieria it can never seem to locate what I
am looking for. For example, check out the following XML file:
-------------------------
<data>
<aBlock id="1">
<tmpdata>
<stringType>Hi</stringType>
</tmpdata>
<reference>
<id>3</id>
</reference>
</aBlock>
<bBlock id="2">
<message>Wrong one</message>
</bBlock>
<bBlock id="3">
<message>Right One</message>
</bBlock>
</data>
-------------------------
with its corresponding stylesheet:
-------------------------
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head><title>Test</title></head>
<body>
Test output:<br/>
<xsl:for-each select="/data/aBlock">
<xsl:apply-templates mode="subData" select="."/>
</xsl:for-each>
</body>
</html>
</xsl:template>
<xsl:template mode="subData" match="aBlock">
<xslaram name="bBlockRef" select="/data/bBlock[@id='2']"/><br />
<xsl:value-of select="./reference"/><br/>
<!-- Problem Statement -->
The Message is: <xsl:value-of
select="/bBlock[@id=./reference]/message"/>
</xsl:template>
</xsl:stylesheet>
-------------------------
The result looks this:
-------------------------
Test output:
3
The Message is:
-------------------------
So the problem is that trying to match the id attribute to a subNode
in the current node isn't working. I don't know if this is because my
syntax is correct (but the preceding value-of expression shows that it
is functional) or if it is because I am trying to perform illegal
behavior in XSL, or what.
But if anyone could help me out- I would be in your debt.
Randeep Walia