Loading ...
Sorry, an error occurred while loading the content.
 

Re: [XSL-FO] xsl test not working !

Expand Messages
  • Mike Trotman
    If the tags are not present then your first test is false (the tags - because they are not present - do not have a value of empty-text ). If you want to check
    Message 1 of 2 , Nov 1, 2003
      If the tags are not present then your first test is false (the tags -
      because they are not present - do not have a value of 'empty-text').
      If you want to check for a tag NOT being present then (I think) the
      simplest way is 'not $add-chk/ShipToContactName'.

      You could define a variable for the value of each tag and test that
      instead - taht would be more laborious but would allow you to test more
      simply for
      the tag not existing OR not having any content.
      (or define a variable which is the concatenation of the values of all
      the fields you want to check are empty/not there - and test variable for
      having empty content.)

      Or - you might find it easier to check for the existence of the tags toy
      do want, count the total number of child tags and then just do a test on
      the number.
      (or maybe test="count($add-chk/*[starts-with(name(),'ShipTo')]) = 0" --
      I haven't tested that so not sure the syntax is correct).

      HTH

      aananth s wrote:

      >hi,
      >
      > I have the follwoing XML fragment
      >
      > <QuoteShipmentVO>
      > <QuoteShipmentVORow>
      > <QuoteHeaderId>4732</QuoteHeaderId>
      > </QuoteShipmentVORow>
      > </QuoteShipmentVO>
      >
      >and the following xsl fragment
      >
      >
      ><xsl:variable name="add-chk"
      >select="//QuoteShipmentVO/QuoteShipmentVORow"/>
      >
      ><xsl:choose>
      >
      ><xsl:when test="$add-chk/ShipToContactName='' and
      >$add-chk/ShipToCustPartyName='' and
      >
      >$add-chk/ShipToAddress1='' and
      >$add-chk/ShipToAddress2='' and
      >
      >$add-chk/ShipToAddress3='' and
      >$add-chk/ShipToAddress4='' and $add-chk/ShipToCity=''
      >
      >and $add-chk/ShipToCounty='' and
      >$add-chk/ShipToCountry=''"/>
      >
      ><xsl:otherwise>
      >
      ><fo:block xsl:use-attribute-sets="table.data1">Ship
      >To  </fo:block>
      >
      ></xsl:otherwise>
      >
      ></xsl:choose>
      >
      >always prints the otherwise part and not the when part
      >even though the tags in the test condition are not
      >present.
      >What am i missing?Is there a better way to do
      >this?thanks for your inputs.
      >
      >thanks
      >aananth
      >
      >=====
      >STRENGTH IS LIFE , WEAKNESS IS DEATH!
      >
      >__________________________________
      >Do you Yahoo!?
      >Exclusive Video Premiere - Britney Spears
      >http://launch.yahoo.com/promos/britneyspears/
      >
      >
      >To unsubscribe from this group, send an email to:
      >XSL-FO-unsubscribe@egroups.com
      >
      >
      >
      >Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
      >
      >

      --
      Datalucid Limited
      8 Eileen Road
      South Norwood
      London SE25 5EJ
      tel :0208-239-6810
      mob: 0794-725-9760
      email: mike.trotman@...
      UK Co. Reg: 4383635
      VAT Reg.: 798 7531 60
    Your message has been successfully submitted and would be delivered to recipients shortly.