Re: [xml-dev] xsl:if to find the existence of an element

From
Jeni Tennison <>
To
"Vanam, Ravindar" <>
Date
2002-04-10T16:57:16Z
ID
<>
Thread
Re: [xml-dev] xsl:if to find the existence of an element
Hi Ravi,

Questions about XSLT should really go to XSL-List
(http://www.mulberrytech.com/xsl/xsl-list).

> Note: the "value" attribute of "TaxOutOfCountryFlag" is changing.

You can test whether the current element has a TaxOutOfCountryFlag
child element with the simple expression:

  TaxOutOfCountryFlag

There are several ways that you could use this test to get what you
want. Probably the simplest is something like:

<xsl:template match="SendTaxRequest">
  <SendTaxRequest>
    <element name="TransactionIdentifier" type="ebsidicString"
             totalDigits="4" value="TX03"/>
    <element name="BusinessDayDate" type="date" totalDigits="8"
             value="{BusinessDayDate}"/>
    <element name="TaxOutOfCountryFlag" type="ebsidicString"
             totalDigits="1" value="N">
      <xsl:if test="TaxOutOfCountryFlag">
        <xsl:attribute name="value">Y</xsl:attribute>
      </xsl:if>
    </element>
  </SendTaxRequest>
</xsl:template>

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/