[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Simple (external XML) internationalization with XSLT?

Subject: Simple (external XML) internationalization with XSLT?
From: knocte <knocte@xxxxxxxxx>
Date: Mon, 3 Oct 2005 17:20:43 +0200
xslt i18n
Hello.

I am beginning to deal with XSLT at more complicated problems. There
is one now that I cannot figure out how to solve:

This is my XML file:

<root>
  <MyTitle>CODE-XXX</Title>
</root>

This is my XSLT file:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:output method="xml" indent="yes" />

  <xsl:template match="/*">

    <page>

      <title><xsl:value-of select="MyTitle" /></title>

      <content>
        <div class="Image">
          <i18n:text key="1" />
          <img>
            <xsl:attribute
name="href">http://www.example.com/img.gif</xsl:attribute>
            <xsl:attribute name="alt"><i18n:text key="2" /></xsl:attribute>
          </img>
        </div>
      </content>

    </page>

  </xsl:template>

</xsl:stylesheet>


This is an external XML file (called "en-US.xml" for example):

<i18n:language code="en-US">
  <i18n:hash-list>
    <i18n:string key="1">Rendered image</string>
    <i18n:string key="2">Alt text</string>
  </i18n:hash-list>
</i18n:language>


My question is: what do I have to add to my XSLT stylesheet to obtain
the following expected XML result?:

<page>

  <title>CODE-XXX</title>

  <content>
    <div class="Image">
      Rendered image
      <img href="http://www.example.com/img.gif" alt="Alt text" />
    </div>
  </content>

</page>


And another question: can I obtain this result without the need of
applying an XSLT pre-transformation to the XSLT itself? (I mean,
without the need of an extra XSLT stylesheet.)

Thanks in advance.

  Andrew  [ knocte ]

--

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.