Hi,
In the folowing XML snippet:
For the above code,I need to display an error:
"elem2 node is not allowed for name=student as subelem1 is greater than 50"
so the requirement is,elem2 should not be present if subelem1 is > 50.
I have the following XSLT code:
<xsl:template match="/root/template1/elem1/subelem1">
<xsl:variable name="value" select="." />
<xsl:if test="$value > 50" >
subelem1 is greater than 50
<xsl:if test="../../elem2" >
<xsl:message terminate="yes" >
<xsl:value-of select="concat( "elem2 is not allowed for name=....")/>
elem4 exists
</xsl:if>
</xsl:if>
</xsl:template>
Using the above code,I am able to print the error as "elem2 is not allowed for name= ".
Here I am not able to print "name=student". How to print the value of name node?
Also please note that there will be 10 <template1> nodes.so the XSLT has to work for each template1.
Please reply me how to achieve this.
Thanks,
In the folowing XML snippet:
Code:
<template1> <name>student</name> <elem1> <[B]subelem1[/B]>65</[B]subelem1[/B]> <subelem2>15</subelem2> </elem1> <[B]elem2[/B]>100</[B]elem2[/B]> </template1> </root>
"elem2 node is not allowed for name=student as subelem1 is greater than 50"
so the requirement is,elem2 should not be present if subelem1 is > 50.
I have the following XSLT code:
<xsl:template match="/root/template1/elem1/subelem1">
<xsl:variable name="value" select="." />
<xsl:if test="$value > 50" >
subelem1 is greater than 50
<xsl:if test="../../elem2" >
<xsl:message terminate="yes" >
<xsl:value-of select="concat( "elem2 is not allowed for name=....")/>
elem4 exists
</xsl:if>
</xsl:if>
</xsl:template>
Using the above code,I am able to print the error as "elem2 is not allowed for name= ".
Here I am not able to print "name=student". How to print the value of name node?
Also please note that there will be 10 <template1> nodes.so the XSLT has to work for each template1.
Please reply me how to achieve this.
Thanks,
Comment