ram wrote:
Thanks that perfectly works.
let us suppose if i get qmNumber as 01 then i need to get
BRKQM if i get qmNumber is 02 then i need to get BEKQM i have written
the logic like below but I am not able to go second QMNUmber
if QMNumber is 2 its failing.Its showign only qmnumber 1
$qmNumberFromContext is variable which will come either 01/02
$serviceType is Response
<xsl:choose> <xsl:when
test="$serviceType/QMNumber=$qmNumberFromContext"> <xsl:value-of
select="$qmNumberFromContext/precedingibling::QMName[1]/text()"/>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
Your example xml doesn't have a Response element, so what does the
$serviceType/ do there? And certainly
select="$qmNumberFromContext/precedingibling::QMName[1]/text() doesn't
make sense, even if preceding-sibling would be correctly
spelled. Hint: never retype your code but copy and paste.
The following works:
<xsl:template match="/">
<xsl:apply-templates select="/*/QMNumber[.=$qmNumberFromContext]"/>
</xsl:template>
<xsl:template match="QMNumber">
<xsl:choose>
<xsl:when test="text()=$qmNumberFromContext">
<xsl:value-of select="preceding-sibling::QMName[1]/text()"/>
</xsl:when>
</xsl:choose>
</xsl:template>
And in XSLT 2.0 you can use:
<xsl:template match="QMNumber[.=$qmNumberFromContext]">
<xsl:value-of select="preceding-sibling::QMName[1]/text()"/>
</xsl:template>
--
Piet van Oostrum
Cochabamba. URL: http://pietvanoostrum.com/
Nu Fair Trade woonartikelen op http://www.zylja.com
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--