xsl-list
[Top] [All Lists]

Re: [xsl] switching between multiple languages in XSL

2006-06-27 14:32:35
Without more information it's very hard to tell
exactly
what you need. I'm not sure if this is what you need,
but it sounds similar. 

* I have standard HTML that appears in headers and 
  footers or in navigation in pages of the website
  I build with XSLT. This HTML is kept in XML
  syntax in separate files with known names and
  and locations. The HTML that should be included 
  is wrapped by a <root> element something like this: 

  <root>
   <tr> <!-- standard header info --></tr>
  </root>

* in my XSLT, I access these standard configuration
  files and copy in the HTML at appropriate places 
  in the output using the document() function. Like
  this: 

<xsl:template name="body.header">
<xsl:for-each
select="document('shared/BodyHeaderConfig.xml')/root/*"><xsl:copy-of
select="."/></xsl:for-each>
</xsl:template>

This sounds sort of like what you're talking about
with the difference that you want to select different
configuration files based on an attribute or element
value in your source XML file. This could be done
as simply as: 

<xsl:if test="flag='EN'">
 <xsl:call-template name="body.header">
  <xsl:with-param name="config-doc"
select="'BodyHeaderEN.xml'"/>
 </xsl:call-template>
</xsl:if>

and the addition of a "config-doc" parameter in the
templates that open the XML configuration docs and
copy
in their content. 

Sara Mitchell
--- Jason Viers <bean(_at_)beanalby(_dot_)net> wrote:

We're transforming a XML file to HTML via XSL, and
we'd like the XSL to 
be usable across multiple languages.  The XML file
being transformed 
does _not_ have the text we'd like to select
between, just an indication 
as to what language should be used.  There are
things like static 
headers & footers we'd like to switch between based
on the flag in the XML.
   
We'd like to have the language-specific sections in
their own files, so 
the language teams can work on them independently of
the main XSL file.  
We couldn't find a way to do this using <xsl:import>
as we can't have a 
certain one included based on a condition,a nd we
can't really "select" 
out of those, as they're not the source document.

Has anyone tried something similar, or have any
advice how to approach this?

Thanks
Jason



--~------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--