Re: [xsl] XML DIsplay

Subject: Re: [xsl] XML DIsplay
From: Mike Brown <mike@xxxxxxxx>
Date: Wed, 23 Oct 2002 13:05:09 -0600 (MDT)
jud013 wrote:
> Is there a way of displaying two XML documents on dufferent web pages 
> into your browser

Since you asked this on xsl-list, I assume you want to know how, in XSLT, to
access documents other than the main XML source. Just use the document

<!-- $doc = root node of foo.xml -->
<xsl:variable name="doc" select="document('foo.xml')"/>

Then you can reference into foo.xml like

As for "displaying" such documents from "different web pages" in a browser,
I'm not sure what you mean. But you can use XSLT to generate HTML, if you
like. Or if you want to use the browser's XML rendering capabilities, you can
load up a dummy document like

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="getDocs.xsl"?>

and then in getDocs.xsl you could do

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
  <xsl:output method="xml" indent="yes" encoding="iso-8859-1"/>
  <xsl:template match="/">
    <!-- wrapper element needed to keep it well-formed -->
      <xsl:comment>FIRST DOCUMENT</xsl:comment>
      <xsl:copy-of select="document('foo.xml')"/>
      <xsl:comment>SECOND DOCUMENT</xsl:comment>
      <xsl:copy-of select="document('bar.xml')"/>

If you need to pass the referenced filenames as parameters, this will require
either a server-side transformation (CGI, ASP, JSP, servlet or other mechanism
does the transform and delivers HTML to the browser), or the use of
vendor-specific scripting in the browser, such as what IE can use to do custom
invocations of MSXML for XML parsing and XSLT processing. See for a copy of the MSXML FAQ and other related information.

   - Mike
  mike j. brown                   |  xml/xslt:
  denver/boulder, colorado, usa   |  resume:

 XSL-List info and archive:

Current Thread
  • [xsl] XML DIsplay
    • jud013 - Wed, 23 Oct 2002 11:55:59 -0600
      • Mike Brown - Wed, 23 Oct 2002 13:05:09 -0600 (MDT) <=