Wednesday, October 22, 2003

Reading XML Files Using XSLT

I'm learning how to represent non-English data in XML and ran into an article titled "Well-structured XML Goes Cosmopolitan" written by Ilari Aarnio and hosted by Buried in the article was an interesting technique that showed how to read XML documents from within XSLT:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="" xmlns="">
    <xsl:param name="currLang">en</xsl:param>
    <xsl:output method="xml" encoding="UTF-8" indent="yes" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"/>

    <xsl:template match="/">
        <xsl:variable name="cvData">
            <xsl:value-of select="$currLang"/>
    <xsl:apply-templates select="document($cvData)"/>

    <!-- add normal XSLT processing (ie, more template tags) here -->

Post a Comment