Trying to p:insert from p:xslt results in no insertion

Hello,

this is driving me nuts:

I want to

* create a main document (ENML namespace) on the default input port via
`p:inline`
* load an HTML5 file from disk & convert the HTML5 via Tidy to XHTML via
my own `ax:tidy` step
* apply a stylesheet on this XHTML, which extracts (and passes back,
encapsulated in a `c:result`) a sorted nodeset
* insert this sorted nodeset (without the `c:result`[1]) into the main
ENML document, via `p:insert`

However, the result I get is this:

  <?xml version="1.0" encoding="UTF-8"?>
  <en-note xmlns="http://xml.evernote.com/pub/enml2.dtd">
     <div/>
  </en-note>

It should be (abbreviated here) like this:

  <?xml version="1.0" encoding="UTF-8"?>
  <en-note xmlns="http://xml.evernote.com/pub/enml2.dtd">
    <div>
      <ul>
        <li style="list-style-type: none;">1nsane</li>
        <li style="list-style-type: none;">Advent Rising</li>
        <li style="list-style-type: none;">Age of Wonders</li>
        <li style="list-style-type: none;">Age of Wonders 2: The
Wizard's Throne</li>
      </ul>
    </div>
  </en-note>

The XProc, I use, is this, running under XML Calabash (1.1.16-97):

  <?xml version="1.0" encoding="UTF-8"?>
  <p:declare-step name="main"
    xmlns:p="http://www.w3.org/ns/xproc"
    xmlns:c="http://www.w3.org/ns/xproc-step"
    xmlns:ax="http://codeblocker.org/ns/xproc-amix"
    xmlns="http://xml.evernote.com/pub/enml2.dtd"
    exclude-inline-prefixes="#all"
    version="1.0">

    <p:serialization port="result"
      method="xml"
      indent="true"
      encoding="UTF-8"
      omit-xml-declaration="false"/>

    <p:input port="source" primary="true" kind="document">
      <p:inline>
  <en-note
xmlns="http://xml.evernote.com/pub/enml2.dtd"><div></div></en-note>
      </p:inline>
    </p:input>

    <p:output port="result" primary="true"/>

    <p:declare-step name="tidy" type="ax:tidy">
      <p:input port="source" kind="document" primary="true"
sequence="false"/>
      <p:output port="result" primary="true" sequence="false"/>
      <p:exec name="tidy-exec" command="C:\Cygwin\bin\tidy.exe"
source-is-xml="false" result-is-xml="true" wrap-result-lines="false">
        <p:with-option name="args" select="'
          --quiet yes
          --show-warnings no
          --output-xhtml yes
          --bare yes
          --doctype loose
          --numeric-entities yes
          --char-encoding utf8'"/>
      </p:exec>
      <p:unwrap match="c:result"/>
    </p:declare-step>

    <ax:tidy name="tidy-gog">
      <p:input port="source">
        <p:data href="../MediaLibrary/sources/gog/mygog.html"/>
      </p:input>
    </ax:tidy>

    <p:xslt name="sort-gog">
      <p:input port="source"/>
      <p:input port="parameters"><p:empty/></p:input>
      <p:input port="stylesheet">
        <p:document href="gog.xsl"/>
      </p:input>
    </p:xslt>

    <p:insert name="insertGog" match="/en-note/div" position="last-child">
      <p:input port="source">
        <p:pipe port="source" step="main"/>
      </p:input>
      <p:input port="insertion">
        <p:pipe port="result" step="sort-gog"/>
      </p:input>
    </p:insert>

    <p:identity>
      <p:input port="source">
        <p:pipe port="result" step="insertGog"/>
      </p:input>
    </p:identity>

  </p:declare-step>

I have tested every single step and there, the output the steps create
is always as desired. This means, the *tidy* step is flawless, the
*xslt* process returns the desired result, I also tested the *insertion*
step with an inline document on the *insertion port* and that worked out
as well. I also created an, intermediary, second output port and routed
the *xslt* result to that one. It worked out fine. However, as soon as I
want to insert the result of the *xslt* step under the `div` element
into the main document, I get aforementioned result.

[1]: As you may have wondered, yes, I did not remove the `c:result` in
the result from the *xslt*, yet, but that shouldn't confuse the
example.I tested it this way and do not want to confuse things up with
making, eventually, an XPath error in a select attribute.

Received on Thursday, 9 November 2017 22:14:25 UTC