This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: xml include
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: Re: [xsl] xml include
- From: "Zafer Bayraktar" <z-b at turk dot net>
- Date: Wed, 11 Apr 2001 14:02:02 +0200
- References: <002901c086c0$0f143800$3f673c3e@mhkhome> <011601c086c3$9f9dd680$da1539d4@prepro.turk.net> <200101251218.MAA20616@nag.co.uk> <000901c086d3$6c72acd0$da1539d4@prepro.turk.net> <200101251400.OAA24922@nag.co.uk> <006a01c0c276$e53243e0$da1539d4@prepro.turk.net> <200104111131.MAA23376@penguin.nag.co.uk>
- Reply-To: xsl-list at lists dot mulberrytech dot com
Thanx, this worked.
But I inserted the line
<xinclude:include href="xml2.xml"/>
after the first include to xml file and insterted another line
<H2><xsl:value-of select="$x//author2"/></H2>
to xsl. (xml2.xml contains author2). The value of author2 returned is null.
How can I access second included file ?
----- Original Message -----
From: "David Carlisle" <davidc@nag.co.uk>
To: <xsl-list@lists.mulberrytech.com>
Sent: Wednesday, April 11, 2001 1:31 PM
Subject: Re: [xsl] xml include
>
> 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
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list