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

Re: xml include

Subject: Re: xml include
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 11 Apr 2001 12:31:22 +0100
xml include document
 
   Hi,
       I have two xml files, one of them is included in other:

   <?xml version="1.0"?>
   <document xmlns:xinclude="http://www.w3.org/1999/XML/xinclude">
     <xinclude:include href="xml.xml"/>
   </document>

   And I use this xsl to transform:
   <?xml version="1.0"?>
   <xsl:stylesheet version='1.0'
   xmlns:xsl='http://www.w3.org/1999/XSL/Transform' >
   <xsl:output method="html" />
   <xsl:template match="/">
   <H1><xsl:value-of select="//title"/></H1>
   <H2><xsl:value-of select="//author"/></H2>
   </xsl:template>
   </xsl:stylesheet>

   (xml.xml contains title and author tags)

   The problem is that xsl cannot read title and author tags ... ?

The input to XSL is (logically) a tree. If your XML parser natively
supported xml:include (do any?) and "expanded includes" the way that
it expands entities, then the tree would have <author> as a descendent
of the root node of the input document and your stylesheet would work.

As it is, xml:include is probably just seen as a general element by all
process concerned so you have to follow the link yourself.


   <?xml version="1.0"?>
   <xsl:stylesheet version='1.0'
   xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
      xmlns:xinclude="http://www.w3.org/1999/XML/xinclude">

   <xsl:output method="html" />
   <xsl:template match="/">
   <xsl:variable name="x" select="document(document/xinclude:include/@href)"/>
   <H1><xsl:value-of select="$x//title"/></H1>
   <H2><xsl:value-of select="$x//author"/></H2>
   </xsl:template>
   </xsl:stylesheet> >
 

David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet delivered
through the MessageLabs Virus Control Centre. For further information visit
http://www.star.net.uk/stats.asp

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


Current Thread

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.