Re: Big XSLT applications just got easier to manage

Jeni isn’t talking about standalone modules.

Let me give an example. We want to do l16n of a web form. Generally the structure is going to be all the same, but the labels will be different. So we abstract the shared elements into a separate module that will be imported by the individual localised XSL components. E.g.

layout.xsl:

  <dl>
    <dt><xsl:call-template name='name.label'/></dt>
    <dd><input type='text' name='name'/></dd>
    <dt><xsl:call-template name='email.label'/></dt>
    <dd><input type='text' name='email'/></dd>
  </dl>

form_en.xsl:

  <xsl:import href='layout.xsl'/>
  <xsl:template name='name.label'>Your name:</xsl:template>
  <xsl:template name='email.label'>Your email address:</xsl:template>

form_fr.xsl:

  <xsl:import href='layout.xsl'/>
  <xsl:template name='name.label'>Votre nom:</xsl:template>
  <xsl:template name='email.label'>Votre adresse e-mail:</xsl:template>

Then you just process using whichever version of form.xsl best fits the locale. layout.xsl isn’t a standalone module, but you still need to edit it.

Reply

The content of this field is kept private and will not be shown publicly.