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

Re: [XSL-FO] localization with separate language files

Expand Messages
  • Ronald Muller
    We use a complete different solution after trying several others (including Eliot s suggestion): We write the XSLT documents using JSP (and using the I18n tag
    Message 1 of 4 , Mar 5, 2004
      We use a complete different solution after trying several others (including Eliot's suggestion):

      We write the XSLT documents using JSP (and using the I18n tag library), for every locale a different document is generated and cached as javax.xml.transform.Templates objects. This works great, the only disadvantage might be that it is a Java based solution.


      Ronald Muller
      XIAM Solutions B.V.
      Product Content Management and e-Business Solutions

      ----- Original Message -----
      From: Eliot Kimber
      To: XSL-FO@yahoogroups.com
      Sent: Monday, February 16, 2004 11:55 PM
      Subject: Re: [XSL-FO] localization with separate language files

      odekij61 wrote:

      > Hello,
      > Currently I have one external variables file that stores all
      > boilerplate text for 15 languages.
      > I use the xsl:include statement as the first thing in my main
      > stylesheet. <xsl:include href='fo-variables.xsl'/>
      > I would like to change this to a separate file for every language to
      > ease in translating new words.
      > I would like to do this:
      > <xsl:if test="@language='french'"><xsl:include
      > href='french.xsl'/></xsl:if>
      > <xsl:if test="@language='greek'"><xsl:include href='greek.xsl'/></xsl:if>
      > My problem is it gives the following error: "Keyword xsl:stylesheet
      > may not contain xsl:if"
      > How do I do an if statement or choose statement to only include the
      > corresponding language file?

      You can't.

      A better way to approach this problem is probably to use a separate XML
      document with the translations that you then get as needed, rather than
      using statically-defined variables. For example, if you name your files
      with the language code, then you can do something like this:

      <xsl:variable name="langCode" select="/*/@xml:lang"/>

      <xsl:variable name="boiler-plate-item-one"
      '.xml'),.)/boilerplate[@id = 'item-01']/>

      This will select the <boilerplate> element with the ID "item-01" from
      the file "./trans/boilerplate_zh-CN.xml" [relative to the current
      document, leave out the ",." parameter of document() if you want the URL
      to be relative to the stylesheet] if the value of the root element's
      xml:lang= attribute is "zh-CN".


      W. Eliot Kimber
      Professional Services
      Innodata Isogen
      9030 Research Blvd, #410
      Austin, TX 78758
      (512) 372-8122


      Yahoo! Groups Sponsor

      Yahoo! Groups Links

      a.. To visit your group on the web, go to:

      b.. To unsubscribe from this group, send an email to:

      c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.