|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] How to check for absence of a node?
I need help in testing my input XML for "NA" or empty response as shown.
Please refer to the following code.
I would like to call error-template in case A. I don't find the node "format/tr[2]/td[position()>1]", or B. The value of format/tr[2]/td[position()>1] is "NA" Any input will be greatly appreciated. Thanks. -sm -- XML input ---
<format>
<tr>
<th>th1</th>
<th>th2</th>
<th>th3</th>
<th>th4</th>
<th>th5</th>
<th>th6</th>
<th>th7</th>
<th>th8</th>
</tr>
<tr>
<td>timestamp1</td>
<td>NA</td>
<td>NA</td>
<td>NA</td>
<td>NA</td>
<td>NA</td>
<td>NA</td>
<td>NA</td>
</tr>
</format>
---------------
-- XSL code ---
<xsl:template match="/"><!-- if error tag is present, process that --> <xsl:apply-templates select="//error"/> <!-- else if A. I don't find the node "format/tr[2]/td[position()>1]", or B. The value of all td's in format/tr[2]/td[position()>1] is "NA" call error-template --> Don't know how to code the above conditions A and B. <!-- else, the input XML looks good, start processing it --> <xsl:apply-templates select="format"/> </xsl:template>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








