Re: [xsl] How to get and display part of XML document in IE5/6?

Subject: Re: [xsl] How to get and display part of XML document in IE5/6?
From: Joerg.Heinicke@xxxxxx
Date: Sun, 16 Jun 2002 19:04:39 +0200 (MEST)
> " english.xml#xpointer(/document/language/page(id=1)) "

To make it short:

<xsl:value-of
select="document('english.xml')/document/language/page[@ID=1]"/>

And a bit more explicitely:

In which way are passing the language information (which language is
currently selected) to the XSLT stylesheet?
A proposal:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:param name="lang" select="english"/>
  <xsl:key name="pages" match="page" use="@ID"/>

  <xsl:variable name="lang-doc" select="document(concat($lang,
'.xml'))/document"/>

  <xsl:template match="where-you-want">

    maybe the best method:
    <xsl:for-each select="$lang-doc">
      <xsl:value-of select="key('pages', 1)"/>
    </xsl:for-each>

    or simpler, but not as good as the above:
    <xsl:value-of select="$lang-doc/language/page[@ID=1]"/>

  </xsl:template>
</xsl:stylesheet>

These ways give you access to the language file. The first way works with a
key, which is similar to an index and really fast. The second one is shorter
(simpler), but should not be as fast as the first. But maybe your language
files are very short, so that you will see no difference. Both should work with
IE too.

Regards,

Joerg

-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net


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


Current Thread