Page 1 of 1

How to specify a conditional test in a choose element?

Posted: Mon Feb 07, 2011 5:53 pm
by chymical
Hi,

I am creating a PDF and want to use a logo on the cover that depends on information in the booktitlealt element of the ditamap. This is what I have done:

<xsl:variable name ="logotype">
<xsl copy-of select="/bookmap/booktitle/booktitlealt'/>
</xsl:variable>

<xsl:choose>
<xsl:when test="contains($logotype,'Windows')">
<fo:external-graphic-------------/>
</xsl:when>
<xsl:when test="contains($logotype,'Unix')">
<fo:external-graphic-------------/>
</xsl:when>
<xsl:otherwise>
<fo:external-graphic-------------/>
</xsl:otherwise>
</xsl:choose>

When I publish the PDF, the logo used is always the one in the otherwise section, even though I know that the booktitlealt contains Windows or Unix. Can anyone tell me what I am doing wrong?

Thanks,

John

Re: How to specify a conditional test in a choose element?

Posted: Tue Feb 08, 2011 4:50 pm
by sorin_ristache
Hello,

Is that a DITA OT transformation that you run in Oxygen? If not please specify the name and version of the XSLT processor that runs the transformation.

In either case: what is the message displayed by an xsl:message inserted before xsl:choose?

Code: Select all

<xsl:message>LOGOTYPE = <xsl:value-of select="$logotype"/></xsl:message>

<xsl:choose>
<xsl:when test="contains($logotype,'Windows')">
<fo:external-graphic-------------/>
</xsl:when>
<xsl:when test="contains($logotype,'Unix')">
<fo:external-graphic-------------/>
</xsl:when>
<xsl:otherwise>
<fo:external-graphic-------------/>
</xsl:otherwise>
</xsl:choose>

Regards,
Sorin

Re: How to specify a conditional test in a choose element?

Posted: Tue Feb 08, 2011 10:31 pm
by chymical
Hi,

I solved this by using the maptitle variable that was already defined, so I would guess that my definition of the logotype variable was wrong...