xsl-list
[Top] [All Lists]

RE: test if attribute contains value and proceed

2002-09-25 04:49:23
Hello I need to test if any of the 
/investitionen/massnahme/@datum has a 
value in it. if EVERY @datum is filled with an value, 
proceed.

In other words, if there is some @datum that is equal to "", don't
proceed.

<xsl:if test="not(/investitionen/massnahme/@datum = '')">
  proceed
</xsl:if>

The = family of operators in XSLT (including !=) return true if some
item on the left compares (=, != etc) to some item on the right.

Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com 

 Something like:

<xsl:if test="/investitionen/massnahme/@datum">
<fo:block>everything is ok!</fo:block>
</xsl:if>

what do I not understand with my newbie brain?


<investitionen>
  <massnahme datum="Dezember 2002">
   <produkte>
    <produkt id="1"/>
   </produkte>
  </massnahme>
  <massnahme datum="Juni 2005">
   <produkte>
    <produkt id="3"/>
   </produkte>
  </massnahme>
  <massnahme datum="Juni 2006">
   <produkte>
    <produkt id="4"/>
   </produkte>
  </massnahme>
</investitionen>
=OK

<investitionen>
  <massnahme datum="Dezember 2002">
   <produkte>
    <produkt id="1"/>
   </produkte>
  </massnahme>
  <massnahme datum="">
   <produkte>
    <produkt id="3"/>
   </produkte>
  </massnahme>
  <massnahme datum="Juni 2006">
   <produkte>
    <produkt id="4"/>
   </produkte>
  </massnahme>
</investitionen>
=NOT OK

<investitionen>
  <massnahme datum="">
   <produkte>
    <produkt id="1"/>
   </produkte>
  </massnahme>
  <massnahme datum="">
   <produkte>
    <produkt id="3"/>
   </produkte>
  </massnahme>
  <massnahme datum="">
   <produkte>
    <produkt id="4"/>
   </produkte>
  </massnahme>
</investitionen>
=NOT OK



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>