My Friends,
Thank you for the many suggestions! I have tried them all and my issue, as
suggested by Jean-Francois appears to be related to the fact that my xml tag
"send-fax" is not a direct child of the node I am processing. Instead, it a
"remote descendant". Therefore, I used the following code:
<xsl:when test="count(//send-fax = 0">
I will have to review some docs to clearly understand the "remote descendant"
issue. It points out that I should have done a better job in my original
template design.
Thanks for all the input!
Jeff
-----Original Message-----
From: Pascal Sancho [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 08, 2008 3:20 AM
To: [email protected]
Subject: RE: Using CHOOSE to control image in region-body
Hi,
If you read "<send-fax>Y</send-fax>", it is possible that there are some extra
invisible charaters.
If you want, you can investigate with string-length() and if >1, try to
determine (then discard) unexpected characters.
However, I can imagine 2 simple solutions that should help:
First solution should be to use normalize-space() function, like this:
<xsl:when test="normalize-space(send-fax)='Y'">...
Another solution consists in using contains() function:
<xsl:when test="contains(send-fax,'Y')">...
Just for curiosity, what XSLT engine do you use?
HTH,
Pascal
> -----Message d'origine-----
> De : Jay Bryant [mailto:[EMAIL PROTECTED]
> Envoyé : mardi 7 octobre 2008 23:58
>
> Hi, Jeff,
>
> I whipped up a small test to show how to solve your problem.
> Here's the
> contents of the (very simple) input XML file:
>
> <test>
> <send-fax>Y</send-fax>
> </test>
>
> Here's the (also very simple XSL file):
>
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <xsl:stylesheet version="2.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:template match="test">
> <xsl:choose>
> <xsl:when test="send-fax = 'Y'">
> <xsl:message>Found it</xsl:message>
> </xsl:when>
> <xsl:otherwise>
> <xsl:message>No joy</xsl:message>
> </xsl:otherwise>
> </xsl:choose>
> </xsl:template>
> </xsl:stylesheet>
>
> When I run that XML file against that XSL file, I get "found
> it" on my
> command line.
> I bet you can extrapolate from there how to get the XSL-FO
> content you want.
> If not, let me know and I'll try to help further.
> HTH
>
> Jay Bryant
>
> ----- Original Message -----
> From: "Steffanina, Jeff" <[EMAIL PROTECTED]>
> To: <[email protected]>
>
> FOP 0.95 / Redhat Linux / Java 1.5
> When the tag "send-fax" does not exist print the lilly, when
> send-fax=Y,
> print the pebble. I always get the Lilly. Can you determine why?
>
> <xsl:choose>
> <xsl:when test="./send-fax='Y'">
> <!-- region-before means region before the body(top 1/3 of
> folio -->
> <fo:region-before extent="3.0in"
> background-repeat="no-repeat"
> margin-top=".5in"
> background-image="url('java/images/Pebble.jpg')"
> background-position-vertical="bottom"
> display-align="after" />
> </xsl:when>
> <xsl:otherwise>
> <fo:region-before extent="3.0in"
> background-repeat="no-repeat"
> margin-top=".5in"
> background-image="url('java/images/Lilly.jpg')"
> background-position-vertical="bottom"
> display-align="after" />
> </xsl:otherwise>
> </xsl:choose>
>
> Jeff
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]