Project

Profile

Help

Download (1.34 KB) Statistics
| Branch: | Tag: | Revision:

he / tags / 9.7.0.3 / hej / data / w3c / generate-resolver.xsl @ cb770b3c

1 cb770b3c O'Neil Delpratt
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
2
               xpath-default-namespace="urn:oasis:names:tc:entity:xmlns:xml:catalog">
3
4
    <!-- stylesheet to create the Saxon StandardEntityResolver data from the catalog.xml file -->
5
    <!-- the output needs to be massaged by hand -->
6
7
    <xsl:output method="text"/>
8
9
    <xsl:template match="/">
10
        <xsl:apply-templates select="//public"/>
11
    </xsl:template>
12
13
    <xsl:template match="public">
14
        <xsl:variable name="this" select="."/>
15
        <xsl:variable name="systemId">
16
            <xsl:variable name="content" select="unparsed-text(resolve-uri(@uri, base-uri(.)))"/>
17
            <xsl:for-each select="tokenize($content, '\n')[contains(., 'http:') and contains(., $this/@uri)]">
18
                <xsl:sequence select="replace(., '^.*&quot;(http://www.w3.org\S+?)&quot;.*$', '$1')"/>
19
            </xsl:for-each>
20
        </xsl:variable>
21
        <xsl:text>        register("</xsl:text>
22
        <xsl:value-of select="@publicId"/>
23
        <xsl:text>",&#xa;</xsl:text>
24
        <xsl:text>                 "</xsl:text>
25
        <xsl:value-of select="$systemId"/>
26
        <xsl:text>",&#xa;</xsl:text>
27
        <xsl:text>                 "</xsl:text>
28
        <xsl:value-of select="concat(../@xml:base, @uri)"/>
29
        <xsl:text>");&#xa;</xsl:text>
30
    </xsl:template>
31
32
</xsl:transform>