This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: xml include


On Wed, Apr 11, 2001 at 12:31:22PM +0100, David Carlisle wrote:
>  
>    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.

  Well  actually XInclude is defined in terms of Infoset merging, so it
is not really defined to be processed at the parser level (but it may be
more efficient to implement it this way). I implemented XInclude in
libxml by making a separate function doing the XInclude process
using the including document tree.
   http://xmlsoft.org/html/libxml-xinclude.html#XMLXINCLUDEPROCESS

  Allowing to do it on the input tree of an XSLT transform is an interesting
idea I just added it to xsltproc the command line tool in libxslt.

Daniel

-- 
Daniel Veillard      | Red Hat Network http://redhat.com/products/network/
veillard@redhat.com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]