Page 1 of 1

XML + Compare Nodes In XSLT Stylesheet

Posted: Mon Sep 03, 2007 8:19 pm
by tready29483
Okay,

Very simple for some of you I'm sure. I want to compare to node values and if they don't match apply a class from my style sheet. I know how to apply the css class, but what I can't do is compare the nodes. Can anyone help me with that. Below is sample data:

In this sample I want to test and see if MentorQty = EBOMQty.

Code: Select all


<?xml version="1.0" encoding="utf-8"?>
<BOMResolutionReport>
<ComponentList>
<Component>
<Line>
<MentorFindNumber>106</MentorFindNumber>
<MentorQty>1.0</MentorQty>
<MentorComponentName>A-0000200-01</MentorComponentName>
<EBOMFindNumber>106</EBOMFindNumber>
<EBOMQty>1.0</EBOMQty>
<EBOMComponentName>A-0000200-01</EBOMComponentName>
<EBOMDescription>Test Part for Master Mapping</EBOMDescription>
<FormPer>the form per</FormPer>
<SeeView>the note</SeeView>
<SeeNote>the view</SeeNote>
<Caution>this is the caution</Caution>
<Status>Full Match</Status>
<MappingUsed>Master</MappingUsed>
</Line>

</Component>
</BOMResolutionReport>
Can anyone help me with this?? Thanks a bunch if you can.[/code]

Posted: Tue Sep 04, 2007 11:33 am
by george
Something like below for instance:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="Line">
<xsl:if test="not(MentorQty=EBOMQty)">
...they don't match apply a class from my style sheet...
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Regards,
George