Last active
April 17, 2018 20:11
-
-
Save dwcramer/c65056fd3638e1cdcd052f4d05f2816e to your computer and use it in GitHub Desktop.
Loading collection() from a second document provided on the input port to an xslt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dcramer@anatine-2 ~/Downloads/load-xinclude | |
$ /Applications/xmlcalabash-1.1.20-98/calabash -i ./book.xml load-xinclude.xpl | |
<wrapper xmlns:c="http://www.w3.org/ns/xproc-step"><loadme.xml><book xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"> | |
<title>test</title> | |
<chapter version="5.0" xml:base="file:/Users/dcramer/Downloads/load-xinclude/chapter.xml"> | |
<title>Chapter</title> | |
<para>Ipsum</para> | |
</chapter> | |
<glossary role="auto"/> | |
</book></loadme.xml><glossary.xml><glossary xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"> | |
<title>Terminology</title> | |
<glossentry> | |
<glossterm>Foo</glossterm> | |
<glossdef> | |
<para>bar</para> | |
</glossdef> | |
</glossentry> | |
<title xml:base="file:/Users/dcramer/Downloads/load-xinclude/master-glossary.xml">Main glossary</title><glossentry xml:base="file:/Users/dcramer/Downloads/load-xinclude/master-glossary.xml"> | |
<glossterm>Ipsum</glossterm> | |
<glossdef> | |
<para>Lorem</para> | |
</glossdef> | |
</glossentry><glossentry xml:base="file:/Users/dcramer/Downloads/load-xinclude/master-glossary.xml"> | |
<glossterm>Lorum</glossterm> | |
<glossdef> | |
<para>Ipsum</para> | |
</glossdef> | |
</glossentry> | |
</glossary></glossary.xml></wrapper> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" xmlns:c="http://www.w3.org/ns/xproc-step" | |
version="1.0" name="main"> | |
<p:input port="source"/> | |
<p:output port="result"> | |
<p:pipe port="result" step="test"/> | |
</p:output> | |
<p:xinclude fixup-xml-base="true" name="xinclude"/> | |
<p:load href="glossary.xml"/> | |
<p:xinclude fixup-xml-base="true" name="xinclude-glossary"/> | |
<p:sink/> | |
<p:xslt name="test"> | |
<p:input port="source"> | |
<p:pipe port="result" step="xinclude"/> | |
<p:pipe port="result" step="xinclude-glossary"/> | |
</p:input> | |
<p:input port="parameters"> | |
<p:empty/> | |
</p:input> | |
<p:input port="stylesheet"> | |
<p:inline> | |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:c="http://www.w3.org/ns/xproc-step" version="3.0"> | |
<xsl:output indent="yes" /> | |
<xsl:mode on-no-match="shallow-copy" /> | |
<xsl:template match="/"> | |
<wrapper> | |
<book.xml> | |
<xsl:apply-templates/> | |
</book.xml> | |
<glossary.xml> | |
<xsl:apply-templates select="collection()/db:glossary" xmlns:db="http://docbook.org/ns/docbook" /> | |
</glossary.xml> | |
</wrapper> | |
</xsl:template> | |
</xsl:stylesheet> | |
</p:inline> | |
</p:input> | |
</p:xslt> | |
</p:declare-step> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<book xmlns="http://docbook.org/ns/docbook" | |
xmlns:xi="http://www.w3.org/2001/XInclude" | |
xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"> | |
<title>test</title> | |
<xi:include href="chapter.xml"/> | |
<glossary role="auto"/> | |
</book> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<chapter xmlns="http://docbook.org/ns/docbook" | |
xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"> | |
<title>Chapter</title> | |
<para>Ipsum</para> | |
</chapter> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<glossary xmlns="http://docbook.org/ns/docbook" | |
xmlns:xi="http://www.w3.org/2001/XInclude" | |
xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"> | |
<title>Terminology</title> | |
<glossentry> | |
<glossterm>Foo</glossterm> | |
<glossdef> | |
<para>bar</para> | |
</glossdef> | |
</glossentry> | |
<xi:include href="master-glossary.xml" xpointer="xpath(/*/*)"/> | |
</glossary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<glossary xmlns="http://docbook.org/ns/docbook" | |
xmlns:xi="http://www.w3.org/2001/XInclude" | |
xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"> | |
<title>Main glossary</title> | |
<glossentry> | |
<glossterm>Ipsum</glossterm> | |
<glossdef> | |
<para>Lorem</para> | |
</glossdef> | |
</glossentry> | |
<glossentry> | |
<glossterm>Lorum</glossterm> | |
<glossdef> | |
<para>Ipsum</para> | |
</glossdef> | |
</glossentry> | |
</glossary> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment