[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XML DIsplay

Subject: Re: XML DIsplay
From: Mike Brown <mike@xxxxxxxx>
Date: Wed, 23 Oct 2002 13:05:09 -0600 (MDT)
xml display xslt
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
function.

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

Then you can reference into foo.xml like
select="$doc/foo/bar/baz"

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"?>
<dummy/>

and then in getDocs.xsl you could do

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" indent="yes" encoding="iso-8859-1"/>
  <xsl:template match="/">
    <!-- wrapper element needed to keep it well-formed -->
    <documents>
      <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')"/>
    </documents>
  </xsl:template>
</xsl:stylesheet>

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
msdn.microsoft.com for a copy of the MSXML FAQ and other related information.

   - Mike
____________________________________________________________________________
  mike j. brown                   |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  resume: http://skew.org/~mike/resume/

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


Current Thread
  • XML DIsplay
    • jud013 - Wed, 23 Oct 2002 13:55:13 -0400 (EDT)
      • Mike Brown - Wed, 23 Oct 2002 15:01:33 -0400 (EDT) <=

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.