XML + Compare Nodes In XSLT Stylesheet
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 1
- Joined: Mon Sep 03, 2007 8:13 pm
XML + Compare Nodes In XSLT Stylesheet
Post 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.
Can anyone help me with this?? Thanks a bunch if you can.[/code]
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>
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Something like below for instance:
Regards,
George
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>
George
George Cristian Bina
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service