[xslt] xinclude
- From: Bernhard Zwischenbrugger <bz datenkueche com>
- To: xslt gnome org
- Subject: [xslt] xinclude
- Date: Fri, 10 Aug 2001 18:09:00 +0200
I tried to use xinclude -> does not work
Example: (from http://www.w3.org/TR/xinclude/#example1)
Is there a working example?
main.xml
=======
<?xml version='1.0'?>
<document xmlns:xi="http://www.w3.org/1999/XML/xinclude">
<p>120 Mz is adequate for an average home user.</p>
<xi:include href="disclaimer.xml"/>
</document>
sub.xml
======
<?xml version='1.0'?>
<disclaimer>
<p>The opinions represented herein represent those of the individual
and should not be interpreted as official policy endorsed by this
organization.</p>
</disclaimer>
XSLT
=====
<?xml version="1.0" encoding="UTF-8"?>
<!-- -->
<!-- (C) 2001 -->
<!-- Bernhard Zwischenbrugger -->
<!-- http://datenkueche.com -->
<!-- This Stylesheet copies the XML-File -->
<!-- -->
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:libxslt="http://xmlsoft.org/XSLT/namespace"
xmlns:xi="http://www.w3.org/1999/XML/xinclude"
>
<xsl:output method="xml" version="1.0" encoding="iso-8859-1" indent="yes"/>
<xsl:template match="*|text()">
<xsl:if test="name()">
<xsl:element name="{name()}">
<xsl:for-each select="@*">
<xsl:attribute name="{name()}" select="{text()}"/>
</xsl:for-each>
<xsl:apply-templates select="*|text()"/>
<xsl:value-of select="text()"/>
</xsl:element>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Command
=========
xsltproc --xinclude test.xslt main.xml
Versions
========
#> xsltproc -V
Using libxml 20400 and libxslt 10000
xsltproc was compiled against libxml 20400 and libxslt 10000
libxslt 10000 was compiled against libxml 20400
#> uname -a
Linux thename 2.2.19 #9 SMP Mon Jun 4 21:02:03 CEST 2001 i686 unknown
herzliche Grüsse
Bernhard
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]