W3C home > Mailing lists > Public > public-xml-processing-model-wg@w3.org > March 2013

Use case 5.11

From: Norman Walsh <ndw@nwalsh.com>
Date: Thu, 07 Mar 2013 11:45:13 -0600
To: public-xml-processing-model-wg@w3.org
Message-ID: <m238w7yuhi.fsf@nwalsh.com>
Good morning,

This morning, Alex and I had a brief IM chat about use case 5.11

  http://www.w3.org/TR/xproc-requirements/#use-case-make-absolute-urls

I think this pipeline (would) solve 5.11:

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="1.0"
                xmlns:c="http://www.w3.org/ns/xproc-step"
                xmlns:cx="http://xmlcalabash.com/ns/extensions"
                xmlns:exf="http://exproc.org/standard/functions"
                exclude-inline-prefixes="cx exf"
                name="main">
<p:input port="source"/>
<p:input port="parameters" kind="parameter"/>
<p:output port="result"/>
<p:serialization port="result" indent="true"/>

<p:xinclude fixup-xml-base="true"/>

<p:delete match="@xml:base"/>

<p:validate-with-xml-schema>
  <p:input port="schema">
    <p:document href="schema.xsd"/>
  </p:input>
</p:validate-with-xml-schema>

<p:xslt>
  <p:input port="stylesheet">
    <p:document href="fixuris.xsl"/>
  </p:input>
</p:xslt>

</p:declare-step>

With this fixuris.xsl stylesheet:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
		exclude-result-prefixes="xs"
                version="2.0">

<xsl:import-schema schema-location="schema.xsd"/>

<xsl:template match="element()">
  <xsl:copy>
    <xsl:apply-templates select="@*,node()"/>
  </xsl:copy>
</xsl:template>

<xsl:template match="attribute(*,xs:anyURI)">
  <xsl:attribute name="{node-name(.)}" select="resolve-uri(.)"/>
</xsl:template>

<xsl:template match="attribute()|text()|comment()|processing-instruction()">
  <xsl:copy/>
</xsl:template>

</xsl:stylesheet>

and this schema:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
  <xs:element name="doc">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="title"/>
        <xs:element maxOccurs="unbounded" ref="chap"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="title" type="xs:string"/>
  <xs:element name="chap">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="title"/>
        <xs:element maxOccurs="unbounded" ref="para"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="para">
    <xs:complexType mixed="true">
      <xs:attribute name="href" use="required" type="xs:anyURI"/>
      <xs:attribute name="non-href" use="required"/>
    </xs:complexType>
  </xs:element>
</xs:schema>

Unfortunately, Saxon's XSD validation appears to lose base URIs. :-(

I'm pursuing that on the saxon-help list.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh
Lead Engineer
MarkLogic Corporation
Phone: +1 512 761 6676
www.marklogic.com

Received on Thursday, 7 March 2013 17:45:45 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 7 March 2013 17:45:45 GMT