Skip to content

Commit

Permalink
Support '!/'-style paths to files inside ZIPs
Browse files Browse the repository at this point in the history
see issue #32
  • Loading branch information
bertfrees authored and josteinaj committed Jan 30, 2017
1 parent 2a902fd commit 4ae7bb4
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/main/resources/content/xml/xproc/utils/load.xpl
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,29 @@
<p:sink/>

<p:choose>
<p:when test="contains($href, '!/')">
<pxi:message>
<p:input port="source">
<p:inline>
<doc/>
</p:inline>
</p:input>
<p:with-option name="message" select="replace($href, '^([^!]+)!/(.+)$', 'loading $2 from ZIP $1')"/>
<p:with-option name="logfile" select="$logfile">
<p:empty/>
</p:with-option>
</pxi:message>
<p:sink/>
<cx:unzip>
<!--
note that "file" needs to be specified before "href" because otherwise $href
variable in select part is affected
-->
<p:with-option name="file" select="replace($href, '^([^!]+)!/(.+)$', '$2')"/>
<p:with-option name="href" select="replace($href, '^([^!]+)!/(.+)$', '$1')"/>
</cx:unzip>
</p:when>

<!-- Force HTML -->
<p:when test="$method='html'">
<pxi:html-load>
Expand Down

0 comments on commit 4ae7bb4

Please sign in to comment.