<Need Help>How to read an element based on condition in XSLT?

Joined
Sep 12, 2008
Messages
3
Reaction score
0
Hi,
I have the following question:

XML snippet:

<root>

<template1>
<elem1>10</elem1>
<elem2>20</elem2>
<elem3>
<subelem1>65</subelem1>
<subelem2>65</subelem2>
</elem3>
</template1>

<template1>
<elem1>10</elem1>
<elem2>20</elem2>
<elem3>
<subelem1>45</subelem1>
<subelem2>15</subelem2>
</elem3>
<elem4>100</elem4>
</template1>

</root>

I want to check that elem4 must be present under template1 only if the value of subelem1 is < 60.If this condition fails then a error message has to be displayed.

I did the template match as follows:
<xsl:template match="/root/template1/elem3/subelem[. >60 ]/> but how to check the existense of elem4?

Please reply me how to achieve this in XSLT?

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top