Re: [xsl] i18n approach

Subject: Re: [xsl] i18n approach
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Tue, 6 Feb 2001 09:51:11 +0000
Hi Dimitre,

>> In order to use a single XSLT stylesheet on a particular set of
>> source XML files, they need to have something in common.
>
> The most common feature is that they are written in XML.

Well, OK.  You can do things like have a stylesheet that always copies
whatever source XML you pass it, or always just gets rid of it, or
turns it into a browsable tree like the inbuilt stylesheet on IE does.

On the i18n side, you can easily put together a generic stylesheet
that filters for a particular language:

<xsl:param name="lang" select="'en'" />

<xsl:template match="@*|node()">
   <xsl:if test="lang($lang)">
      <xsl:copy>
         <xsl:apply-templates select="@*|node()" />
      </xsl:copy>
   </xsl:if>
</xsl:template>

Or I guess you could create a generic stylesheet that accessed and
copied a source XML file in a particular language:

<xsl:param name="lang" select="'en'" />

<xsl:template match="/">
   <xsl:copy-of select="document(concat('source_', $lang, '.xml'))" />
</xsl:template>

> I think Jeni is being shy here -- I know a whole class of very
> different XML files that have a very useful single stylesheet to
> process them -- the XML files are an instance of any possible
> stylesheet, the stylesheet is her XSLDoc application...

The XSLTDoc application actually uses knowledge about the *XSLT*
vocabulary to build up its views, and couldn't do half the things it
does if it didn't.

But yes, I concede that generic viewers and browsers are a set of
applications that are possible without an intimate knowledge of a
particular XML vocabulary (though I think that they can be much
enhanced if they know a bit about general things like XInclude, XLink,
XML schemas and other special vocabularies). I don't think that
Andreas was after a generic viewer, though.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread