Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] Simple (external XML) internationalization with XSLT?

From: "M. David Peterson" <m.david.x2x2x@--------->
To:
Date: 10/3/2005 5:09:00 PM
Hi Andrew,

I'm guessing this is just a typo as your XML parser would have
screamed at you before even getting to the transformation process. 
But just in case, this:

<i18n:string key="1">Rendered image</string>
<i18n:string key="2">Alt text</string>

should be:

<i18n:string key="1">Rendered image</i18n:string>
<i18n:string key="2">Alt text</i18n:string>

With the list of folks who have answered your post thus far I'm sure
if they saw it as anything more than a typo they would have said so...
but I thought it might be worth mentioning on the off chance that this
is a copy-and-paste from your editor to email and it simply got
overlooked by the others.  If this is the case, your not going to see
what you want to see until you fix this at which point you can begin
to debug your transformation if this in and of itself doesn't fix
things.

On 10/3/05, knocte <knocte@xxxxxxxxx> wrote:
> 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 ]
>
> --
>
>


--
<M:D/>

M. David Peterson
http://www.xsltblog.com


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent