Re: [xsl] xml include

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

   <?xml version="1.0"?>
   <document xmlns:xinclude="";>
     <xinclude:include href="xml.xml"/>

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

   (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'

   <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:stylesheet> >


This message has been checked for all known viruses by Star Internet delivered
through the MessageLabs Virus Control Centre. For further information visit

 XSL-List info and archive:

Current Thread