2006/ws/policy addlinenumbers.xsl,NONE,1.1 xmlspec-policy-xsl1-0.xsl,NONE,1.1

Update of /sources/public/2006/ws/policy
In directory hutz:/tmp/cvs-serv29651/policy

Added Files:
	addlinenumbers.xsl xmlspec-policy-xsl1-0.xsl 
Log Message:
XSLT for generating XML with generated line numbers in examples. Necessary only for TR space publication, no influence on editors draft generation.

--- NEW FILE: xmlspec-policy-xsl1-0.xsl ---
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:import href="xmlspec.xsl"/>
    <xsl:import href="changelog.xsl"/>
    <xsl:output method="html" encoding="utf-8"
        doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
        doctype-system="http://www.w3.org/TR/html4/loose.dtd" indent="no"/>
    <!-- overriding default empty root template to allow passthru of the changelog parameter -->
    <xsl:template match="/">
        <xsl:param name="changelog"/>
        <xsl:apply-templates>
            <xsl:with-param name="changelog" select="$changelog"/>
        </xsl:apply-templates>
    </xsl:template>
    <xsl:template match="inform-div1[head='Change Log']/div2/p[@role]">
        <xsl:variable name="changelog" select="@role"/>
        <xsl:apply-templates select="document('changelog.xml')">
            <xsl:with-param name="changelog" select="$changelog"/>
        </xsl:apply-templates>
    </xsl:template>
    <!-- bibref: reference to a bibliographic entry -->
    <!-- make a link to the bibl -->
    <!-- if the bibl has a key, put it in square brackets; otherwise use
       the bibl's ID -->
    <xsl:template match="bibref">
        <!--<xsl:text>[</xsl:text> -->
        <cite>
            <a>
                <xsl:attribute name="href">
                    <xsl:call-template name="href.target">
                        <xsl:with-param name="target" select="id(@ref)"/>
                    </xsl:call-template>
                </xsl:attribute>
                <xsl:choose>
                    <xsl:when test="id(@ref)/@key">
                        <xsl:value-of select="id(@ref)/@key"/>
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:value-of select="@ref"/>
                    </xsl:otherwise>
                </xsl:choose>
            </a>
        </cite>
        <!--<xsl:text>]</xsl:text> -->
    </xsl:template>
    <xsl:template match="bibl">
        <dt class="label">
            <xsl:attribute name="class">
                <xsl:choose>
                    <xsl:when test="@diff and $show.diff.markup != 0">
                        <xsl:text>diff-</xsl:text>
                        <xsl:value-of select="@diff"/>
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:text>label</xsl:text>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:attribute>
            <xsl:if test="@id">
                <a name="{@id}"/>
            </xsl:if>
            <xsl:text>[</xsl:text>
            <xsl:choose>
                <xsl:when test="@key">
                    <xsl:value-of select="@key"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="@id"/>
                </xsl:otherwise>
            </xsl:choose>
            <xsl:text>] </xsl:text>
        </dt>
        <dd>
            <xsl:if test="@diff and $show.diff.markup != 0">
                <xsl:attribute name="class">
                    <xsl:text>diff-</xsl:text>
                    <xsl:value-of select="@diff"/>
                </xsl:attribute>
            </xsl:if>
            <xsl:apply-templates/>
            <xsl:if test="not(titleref) and @href">
                <xsl:text> (See </xsl:text>
                <cite>
                    <a href="{@href}">
                        <xsl:value-of select="@href"/>
                    </a>
                </cite>
                <xsl:text>.)</xsl:text>
            </xsl:if>
        </dd>
    </xsl:template>
    <xsl:template match="titleref">
        <xsl:choose>
            <xsl:when test="../@href">
                <cite>
                    <a href="{../@href}">
                        <xsl:apply-templates/>
                    </a>
                </cite>
            </xsl:when>
            <xsl:otherwise>
                <cite>
                    <xsl:apply-templates/>
                </cite>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
    <!--
    <xsl:template match="b">
        <b>
            <xsl:apply-templates/>
        </b>
    </xsl:template>
    <xsl:template match="u">
        <u>
            <xsl:apply-templates/>
        </u>
    </xsl:template>
    <xsl:template match="i">
        <i>
            <xsl:apply-templates/>
        </i>
    </xsl:template>
-->
    <xsl:template match="emph[@role='infoset-property']">
        <strong>
            <xsl:text>[</xsl:text>
            <xsl:apply-templates/>
            <xsl:text>]</xsl:text>
        </strong>
    </xsl:template>

    <!-- Filtering term definitions in the terminology section. These are taken from the WS-Policy-Framework document and are handled separately in extract-glist.xsl .-->
    <xsl:template match="ulist[@role='termreference']"/>

<!-- Used for wsdl11elementidentifiers.xml to allow italics within 
code -->
<xsl:template match="code[@role='code-emph']">
<code style="font-style: italic;"><xsl:value-of select="."/></code>
</xsl:template>
</xsl:stylesheet>

--- NEW FILE: addlinenumbers.xsl ---
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
  <xsl:output method="xml" encoding="utf-8"
        doctype-public="-//W3C//DTD Specification V2.10//EN"
        doctype-system="xmlspec.dtd" indent="no"/>
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>
  <xsl:template match="eg[@role='needs-numbering']">
<eg>
<xsl:for-each select="@*[not(name()='role')]">
<xsl:copy-of select="."/>
<xsl:attribute name="role"><xsl:text>numberAddedAutomatically</xsl:text></xsl:attribute>
</xsl:for-each>
        <xsl:variable name="egWithLb" as="item()*">
            <egWithLb>
                <lb/>
                <xsl:for-each select="text()|node()">
                    <xsl:choose>
                        <xsl:when test="self::text()">
                            <xsl:analyze-string select="." regex="&#xA;">
                                <xsl:matching-substring>
                                    <xsl:text>&#xA;</xsl:text>
                                    <lb/>
                                </xsl:matching-substring>
                                <xsl:non-matching-substring>
                                    <xsl:value-of select="."/>
                                </xsl:non-matching-substring>
                            </xsl:analyze-string>
                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:copy-of select="."/>
                        </xsl:otherwise>
                    </xsl:choose>
                </xsl:for-each>
            </egWithLb>
        </xsl:variable>
        <xsl:apply-templates select="$egWithLb/node()" mode="addLineNumbers"/>
</eg>
    </xsl:template>
    <xsl:template match="lb" mode="addLineNumbers">
        <xsl:choose>
            <xsl:when
                test="not(contains(self::lb/following-sibling::text()[1],'xmlns'))">
                <xsl:text>(</xsl:text>
                <xsl:number format="01"
                    count="lb[not(contains(self::lb/following-sibling::text()[1],'xmlns'))]"/>
                <xsl:text>) </xsl:text>
            </xsl:when>
        </xsl:choose>
    </xsl:template>
    <xsl:template match="node()" mode="addLineNumbers">
        <xsl:copy-of select="."/>
    </xsl:template>
</xsl:stylesheet>

Received on Wednesday, 4 April 2007 08:13:39 UTC