Solved

Add to XSL so it disregards certain lines on incoming xml

Posted on 2012-03-30
4
267 Views
Last Modified: 2012-03-30
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
0
Comment
Question by:MrWeen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 500 total points
ID: 37788717
<xsl:for-each select="SorSalesOrderInvoiceDocuments/SalesOrderInvoiceDocument/Merchandise[not(MStockCode= 'FRGT') and not(MStockCode = 'FRGH')]">
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 37788734
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')]">
0
 

Author Closing Comment

by:MrWeen
ID: 37788810
Thank you.  This worked perfectly.  Thank you for the additional tips as well.
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 37788975
welcome
0

Featured Post

Raise the IQ of Your IT Alerts

From IT major incidents to manufacturing line slowdowns, every business process generates insights that need to reach the people required to take action. You need a platform that integrates with your business tools to create fully enabled DevOps toolchains.

You need xMatters.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question