Multiple For-Each conditions


Essentially all I am looking to do is have a For Each at the record level that prevents any records with a [Total != 0] to be filtered out of the dataset.


I have attempted quite a few different syntax’s but none have worked

Syntax 1:

 $Input_Schema_APExtract/Root/Record[Total != '0']

This one will give an error in the XML:

Error message: '..[predicate]' or '.[predicate]' is illegal syntax. Use 'self::node()[predicate]' instead.
<xsl:for-each select=".[Total != '0']">
<xsl:apply-templates select="." mode="_cXML_Request_InvoiceDetailRequest_order1"></xsl:apply-templates>


Syntax 2:

$Input_Schema_APExtract/Root/Record/Total[Total != '0']

This one will stop any XML errors but at the same time it simply will not allow any records to be converted.

 <xsl:for-each select="Total[Total != '0']">
<xsl:apply-templates select=".." mode="_cXML_Request_InvoiceDetailRequest_order1"></xsl:apply-templates>



Is it possible to have two conditions for the ForEach?

Let’s say [Total != 0] AND [Tax != 0]??



1) Remove the mapping between Record and Target node with the for each rule applied (InvoiceDetailRequest) and implement the for each rule again

2) Include both conditions within a single bracket - $Input_Schema_APExtract/Root/Record[Total != 0 and Tax !=0]


Have more questions? Submit a request


Article is closed for comments.