[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] XInclude of part of current document
El Jueves, 5 de Abril de 2007 19:22, Bob Stayton escribió: > The XInclude spec seems to allow an href from an xi:include to part of the > current document, by using either an empty href or an absent href in the > xi:include element. However, it doesn't seem to work. It works for me: ----- test.xml ---- <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> <sect1> <title>Testing XInclude</title> <para>Para 1</para> <para>Para 2</para> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" xpointer="xpointer(/sect1[1]/para[1])"/> </sect1> --------------------------------- ~/test$ xmllint --xinclude --postvalid test.xml <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> <sect1> <title>Testing XInclude</title> <para>Para 1</para> <para>Para 2</para> <para>Para 1</para> </sect1> You must be very careful with the xpointer expresion used. The above is the most failsafe one, but not very useful if the sources tree is changing. I prefer to assign an ID to any element that will be Xinclude and then cal it using xpointer="xpointer(//@id='string')". There is more simple call for IDs, but that works also for XML documents that don't have a DTD. -- Manuel Canales Esparcia Usuario de LFS nº2886: http://www.linuxfromscratch.org LFS en castellano: http://www.escomposlinux.org/lfs-es http://www.lfs-es.info TLDP-ES: http://es.tldp.org
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]