Link to home
Start Free TrialLog in
Avatar of MrWeen
MrWeen

asked on

Add to XSL so it disregards certain lines on incoming xml

I have an XSL with a for-each select that ignores the text FRGT.  I need to add that it should also ignore FRGH.  How do I add it?

<xsl:for-each select="SorSalesOrderInvoiceDocuments/SalesOrderInvoiceDocument/Merchandise[MStockCode/text() != 'FRGT']">

Thank you
ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
two notes

- it is better to use not(... = ...) instead of ... !=... since equality in a predicate is a set compare
- you should not compare against the text() node because the text you are comparing against can be split in multiple text nodes

I usually compare against the normalized-space actually

<xsl:for-each select="SorSalesOrderInvoiceDocuments/SalesOrderInvoiceDocument/Merchandise[not(normalize-space(MStockCode)= 'FRGT') and not(normalize-space(MStockCode) = 'FRGH')]">
Avatar of MrWeen
MrWeen

ASKER

Thank you.  This worked perfectly.  Thank you for the additional tips as well.