OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Subject: Re: DOCBOOK: Conditional xsl:output ? Help


On Mon, 9 Oct 2000, [iso-8859-1] Stéphane Bline wrote:

> <xsl:variable name="lang-attr"
>                       select="($target/ancestor-or-self::*/@lang
> 
> |$target/ancestor-or-self::*/@xml:lang)[last()]"/>
> <xsl:choose>
>   <xsl:when test="string($lang-attr) = 'pl'">
>     <xsl:output encoding="ISO-8859-2"/>
>   </xsl:when>
>   <xsl:otherwise>
>     <xsl:output encoding="ISO-8859-1"/>
>   </xsl:otherwise>
> </xsl:choose>
> 
> Unfrotunately, this does not work. Is this something that XSL can't do or am
> I doing it the wrong way ?

<xsl:output/> must be nested directly in the root element, you can not use
it in templates.

I know two solutions to your problem, but none of them is standard and
crossplatform.

1. Use extension of XSLT processor which are able to produce multiple
output documents (this supports XT, Saxon, Xalan and probably other
engines). Then use something like this

<xsl:template match="/">
  <xsl:param name="firstTime">1</xsl:param>
  <xsl:if test="$firstTime = '1'">
    ... there comes switches between encodings ...
    <xt:output method="..." encoding="...">
      <xsl:apply-templates select="/">
        <xsl:with-param name="firtsTime">0</xsl:with-param>
      </xsl:apply-templates>
    </xt:output>
    ....
  </xsl:if>
  <xsl:if test="$firstTime = '0'">
    ... there goes normal processing of root
  </xsl:if>
</xsl:template>

I did not test it, but I hope it works.

2. Some XSLT processor can use expressions in encoding atribute of
<xsl:output>. I know this is supported by Saxon. To enable this future,
you must provide some Saxon specific attribute to <xsl:output>. I do not
remember details, but it is described in Saxon docs.

-----------------------------------------------------------------
  Jirka Kosek  	                     
  e-mail: jirka@kosek.cz
  http://www.kosek.cz



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Powered by eList eXpress LLC