Mode:

Compact lists

Showing:

Documentation
Parameters
Used by
References
Included from
Source
Stylesheet RngToRnc.xsl
Documentation

Description

*- XML -*
 adapted by Sebastian Rahtz from: 
 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
 $Id: RngToRnc.xsl 9513 2011-10-17 08:55:51Z rahtz $ 
 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
 
  modified 2010-08-14 by Syd Bauman:
     bug-fix: modified expressions defining 'pfx' variables
     so that only 1 namespace is handed to name().
 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

     Copyright (c) 2002, Pantor Engineering AB
     All rights reserved.
     
     Redistribution and use in source and binary forms, with or
     without modification, are permitted provided that the following
     conditions are met:
     
     * Redistributions of source code must retain the above copyright
       notice, this list of conditions and the following disclaimer. 

     * Redistributions in binary form must reproduce the above
       copyright notice, this list of conditions and the following
       disclaimer in the documentation and/or other materials provided
       with the distribution.

     * Neither the name of Pantor Engineering AB nor the names of its
       contributors may be used to endorse or promote products derived
       from this software without specific prior written permission.
     
     THIS   SOFTWARE   IS PROVIDED BY    THE   COPYRIGHT  HOLDERS  AND
     CONTRIBUTORS "AS IS"   AND ANY  EXPRESS OR  IMPLIED   WARRANTIES,
     INCLUDING,  BUT  NOT LIMITED  TO,   THE  IMPLIED  WARRANTIES   OF
     MERCHANTABILITY    AND  FITNESS  FOR   A  PARTICULAR  PURPOSE ARE
     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
     BE  LIABLE   FOR ANY    DIRECT, INDIRECT,   INCIDENTAL,  SPECIAL,
     EXEMPLARY, OR CONSEQUENTIAL DAMAGES  (INCLUDING, BUT NOT  LIMITED
     TO, PROCUREMENT  OF  SUBSTITUTE GOODS OR  SERVICES;  LOSS OF USE,
     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
     ANY THEORY OF  LIABILITY, WHETHER IN CONTRACT,  STRICT LIABILITY,
     OR  TORT (INCLUDING NEGLIGENCE OR  OTHERWISE) ARISING  IN ANY WAY
     OUT OF  THE  USE OF   THIS  SOFTWARE,  EVEN IF ADVISED   OF   THE
     POSSIBILITY OF SUCH DAMAGE.

     +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
     Created by David.Rosenborg@pantor.com
     +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

     RngToRncText.xsl converts a RELAX NG schema in XML syntax to the
     compact syntax.

     If the source document is a RELAX NG schema, an extension
     function converting result tree fragments to node sets is
     required. If the processor supports the exslt:node-set function,
     no configuration should be needed. See RngToRncProcessorConfig.xsl
     for further information.

     This stylesheet can also be applied to the intermediate XML
     representation of a compact schema as output by the
     RngToRncXml.xsl stylesheet. In this case, no extension function
     is required.

     For a description of the underlying XML to compact syntax
     transformation, see RngToRncXml.xsl.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
Included from
Stylesheet version 2.0
Template str
Namespace No namespace
Used by
Parameters
QName Namespace Select
is-multiline No namespace false ()
quote No namespace '"'
text No namespace
Import precedence 1
Source
<xsl:template name="str">
  <xsl:param name="text"/>
  <xsl:param name="quote" select="'"'"/>
  <xsl:param name="is-multiline" select="false ()"/>
  <xsl:variable name="lit" select="concat ($quote, $text, $quote)"/>
  <str size="{string-length ($lit)}">
    <xsl:if test="$is-multiline">
      <xsl:attribute name="multiline">yes</xsl:attribute>
    </xsl:if>
    <xsl:value-of select="$lit"/>
  </str>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template text
Namespace No namespace
Used by
Parameters
QName Namespace
text No namespace
Import precedence 1
Source
<xsl:template name="text">
  <xsl:param name="text"/>
  <xsl:attribute name="size">
    <xsl:value-of select="string-length ($text)"/>
  </xsl:attribute>
  <xsl:value-of select="$text"/>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template make-compact-schema
Namespace No namespace
Used by
References
Import precedence 1
Source
<xsl:template name="make-compact-schema">
  <compact-schema>
    <!-- Declarations -->
    <xsl:if test="$has-default-ns">
      <xsl:call-template name="make-ns-declaration">
        <xsl:with-param name="is-default" select="true ()"/>
        <xsl:with-param name="prefix" select="$default-ns-id"/>
        <xsl:with-param name="uri" select="$default-ns"/>
      </xsl:call-template>
    </xsl:if>
    <xsl:if test="$has-local">
      <xsl:call-template name="make-ns-declaration">
        <xsl:with-param name="prefix" select="'local'"/>
        <xsl:with-param name="uri" select="''"/>
      </xsl:call-template>
    </xsl:if>
    <xsl:call-template name="inhnamespace"/>
    <!--
      <xsl:choose>
	<xsl:when test="$retain-prefixes">
	  <xsl:for-each select="//*">
	    <xsl:variable name="elm" select="self::*"/>
	    <xsl:for-each select="namespace::*">
	      <xsl:variable name="ns" select="string (.)"/>
	      <xsl:if test="(not ($has-default-ns) or $ns != $default-ns) and
		count (key ('ns', $ns)[1] | $elm) = 1 and
		name (.) != 'xml' and 
		((not ($ns = 'http://relaxng.org/ns/structure/1.0') and 
		//*[namespace-uri (.) = $ns or @ns = $ns or 
		@*[namespace-uri (.) = $ns]]) or 
		//*[namespace-uri (.) != 
		'http://relaxng.org/ns/structure/1.0']//
		*[namespace-uri (.) = $ns or @*[namespace-uri (.) = $ns]] or
		key ('prefix', name (.)))">
		<xsl:call-template name="make-ns-declaration">
		  <xsl:with-param name="prefix">
		    <xsl:variable name="mapped">
		      <xsl:call-template name="mapped-prefix">
			<xsl:with-param name="ns" select="string (.)"/>
		      </xsl:call-template>
		    </xsl:variable>
		    <xsl:choose>
		      <xsl:when test="string ($mapped)">
			<xsl:value-of select="$mapped"/>
		      </xsl:when>
		      <xsl:when test="name (.)">
			<xsl:value-of select="name (.)"/>
		      </xsl:when>
		      <xsl:otherwise>
			<xsl:value-of select="generate-id ($elm)"/>
		      </xsl:otherwise>
		    </xsl:choose>
		  </xsl:with-param>
		  <xsl:with-param name="uri" select="."/>
		</xsl:call-template>
	      </xsl:if>
	    </xsl:for-each>
	  </xsl:for-each>
	</xsl:when>

	<xsl:otherwise>
	  <xsl:for-each select=".//rng:element | .//rng:attribute">
	    <xsl:if test="@name [contains (., ':')]">
	      <xsl:variable name="pfx" select="substring-before (@name, ':')"/>
	      <xsl:if test="count (key ('prefix', $pfx)[1] | @name) = 1">
		<xsl:variable name="ns"
		  select="string (namespace::*[name () = $pfx])"/>
		<xsl:call-template name="make-ns-declaration">
		  <xsl:with-param name="prefix">
		    <xsl:variable name="mapped">
		      <xsl:call-template name="mapped-prefix">
			<xsl:with-param name="ns" select="$ns"/>
		      </xsl:call-template>
		    </xsl:variable>
		    <xsl:choose>
		      <xsl:when test="string ($mapped)">
			<xsl:value-of select="$mapped"/>
		      </xsl:when>
		      <xsl:otherwise>
			<xsl:value-of select="$pfx"/>
		      </xsl:otherwise>
		    </xsl:choose>
		  </xsl:with-param>
		  <xsl:with-param name="uri" select="$ns"/>
		</xsl:call-template>
	      </xsl:if>
	    </xsl:if>
	  </xsl:for-each>

	  <xsl:for-each select="//*[not (self::rng:*)] | 
	                        //*/@*[namespace-uri (.) != '']">
	    <xsl:variable name="ns" select="namespace-uri (.)"/>
	    <xsl:if test="count (key ('annot-ns', $ns)[1] | .) = 1">
	      <xsl:call-template name="make-ns-declaration">
		<xsl:with-param name="prefix">
		  <xsl:variable name="mapped">
		    <xsl:call-template name="mapped-prefix">
		      <xsl:with-param name="ns" select="$ns"/>
		    </xsl:call-template>
		  </xsl:variable>
		  <xsl:choose>
		    <xsl:when test="string ($mapped)">
		      <xsl:value-of select="$mapped"/>
		    </xsl:when>
		    <xsl:otherwise>
		      <xsl:value-of select="generate-id (.)"/>
		    </xsl:otherwise>
		  </xsl:choose>
		</xsl:with-param>
		<xsl:with-param name="uri" select="$ns"/>
	      </xsl:call-template>
	    </xsl:if>
	  </xsl:for-each>
	</xsl:otherwise>
      </xsl:choose>
      
      <xsl:for-each select="//@datatypeLibrary">
	<xsl:if test=". != $xsd and . != ''">
	  <declaration size="9">datatypes</declaration>
	  <sp size="1"/>
	  <prefix>
	    <xsl:call-template name="text">
	      <xsl:with-param name="text" select="generate-id (.)"/>
	    </xsl:call-template>
	  </prefix>
	  <t size="3"> = </t>
	  <xsl:call-template name="str">
	    <xsl:with-param name="text" select="."/>
	  </xsl:call-template>
	  <nl size="1"/>
	</xsl:if>
      </xsl:for-each>
-->
    <nl size="1"/>
    <!-- Pattern -->
    <xsl:apply-templates mode="RNC"/>
  </compact-schema>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template /rng:grammar
Namespace No namespace
Match /rng:grammar
Mode #default
Import precedence 1
Source
<xsl:template match="/rng:grammar">
  <grammar>
    <xsl:apply-templates mode="RNC"/>
  </grammar>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template make-block
Namespace No namespace
Used by
Parameters
QName Namespace Select
body No namespace
collapse No namespace true ()
head No namespace
Import precedence 1
Source
<xsl:template name="make-block">
  <xsl:param name="head"/>
  <xsl:param name="body"/>
  <xsl:param name="collapse" select="true ()"/>
  <group>
    <xsl:if test="not ($collapse)">
      <xsl:attribute name="collapse">no</xsl:attribute>
    </xsl:if>
    <xsl:copy-of select="$head"/>
    <nl size="1"/>
    <t size="1">{</t>
    <indent>
      <nl size="1"/>
      <xsl:copy-of select="$body"/>
    </indent>
    <nl size="1"/>
    <t size="1">}</t>
  </group>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template make-parenthesis
Namespace No namespace
Used by
Template
Parameters
QName Namespace
body No namespace
Import precedence 1
Source
<xsl:template name="make-parenthesis">
  <xsl:param name="body"/>
  <t size="1">(</t>
  <indent>
    <nl size="1"/>
    <xsl:copy-of select="$body"/>
  </indent>
  <nl size="1"/>
  <t size="1">)</t>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rng:grammarRNC
Namespace No namespace
Match rng:grammar
Mode RNC
References
Templates
Import precedence 1
Source
<xsl:template match="rng:grammar" mode="RNC">
  <grammar>
    <group>
      <xsl:call-template name="annotations"/>
      <xsl:call-template name="make-block">
        <xsl:with-param name="collapse" select="false ()"/>
        <xsl:with-param name="head">
          <keyword size="7">grammar</keyword>
        </xsl:with-param>
        <xsl:with-param name="body">
          <xsl:apply-templates mode="RNC"/>
        </xsl:with-param>
      </xsl:call-template>
    </group>
  </grammar>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rng:list | rng:mixedRNC
Namespace No namespace
Match rng:list | rng:mixed
Mode RNC
References
Import precedence 1
Source
<xsl:template match="rng:list | rng:mixed" mode="RNC">
  <group>
    <xsl:call-template name="annotations"/>
    <xsl:call-template name="make-block">
      <xsl:with-param name="head">
        <keyword>
          <xsl:call-template name="text">
            <xsl:with-param name="text" select="local-name (.)"/>
          </xsl:call-template>
        </keyword>
      </xsl:with-param>
      <xsl:with-param name="body">
        <xsl:call-template name="group-body"/>
      </xsl:with-param>
    </xsl:call-template>
  </group>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rng:startRNC
Namespace No namespace
Match rng:start
Mode RNC
References
Import precedence 1
Source
<xsl:template match="rng:start" mode="RNC">
  <xsl:call-template name="annotations"/>
  <group>
    <define size="5">
      <xsl:copy-of select="@combine"/>
      <xsl:text>start</xsl:text>
    </define>
    <xsl:call-template name="assignment-op"/>
    <indent>
      <nl size="1"/>
      <xsl:call-template name="group-body"/>
    </indent>
  </group>
  <xsl:call-template name="spacer"/>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template assignment-op
Namespace No namespace
Used by
Import precedence 1
Source
<xsl:template name="assignment-op">
  <xsl:choose>
    <xsl:when test="@combine = 'choice'">
      <t size="3"> |=</t>
    </xsl:when>
    <xsl:when test="@combine = 'interleave'">
      <t size="3"> &=</t>
    </xsl:when>
    <xsl:otherwise>
      <t size="2"> =</t>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rng:defineRNC
Namespace No namespace
Match rng:define
Mode RNC
References
Import precedence 1
Source
<xsl:template match="rng:define" mode="RNC">
  <xsl:variable name="grammar" select="ancestor::rng:grammar [1]"/>
  <xsl:call-template name="annotations"/>
  <group>
    <define name="{@name}">
      <xsl:copy-of select="@combine"/>
      <xsl:call-template name="text">
        <xsl:with-param name="text">
          <xsl:call-template name="quote-keyword">
            <xsl:with-param name="name" select="@name"/>
          </xsl:call-template>
        </xsl:with-param>
      </xsl:call-template>
    </define>
    <xsl:call-template name="assignment-op"/>
    <indent>
      <nl size="1"/>
      <xsl:call-template name="group-body"/>
    </indent>
  </group>
  <xsl:call-template name="spacer"/>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rng:divRNC
Namespace No namespace
Match rng:div
Mode RNC
References
Import precedence 1
Source
<xsl:template match="rng:div" mode="RNC">
  <xsl:call-template name="annotations"/>
  <xsl:call-template name="make-block">
    <xsl:with-param name="collapse" select="false ()"/>
    <xsl:with-param name="head">
      <keyword size="3">div</keyword>
    </xsl:with-param>
    <xsl:with-param name="body">
      <xsl:apply-templates mode="RNC"/>
    </xsl:with-param>
  </xsl:call-template>
  <xsl:call-template name="spacer"/>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rng:includeRNC
Namespace No namespace
Match rng:include
Mode RNC
References
Import precedence 1
Source
<xsl:template match="rng:include" mode="RNC">
  <xsl:call-template name="annotations"/>
  <group collapse="no">
    <keyword size="7">include</keyword>
    <sp size="1"/>
    <include-href ref="{generate-id ()}">
      <xsl:call-template name="external"/>
    </include-href>
    <xsl:if test="*">
      <nl size="1"/>
      <t size="1">{</t>
      <indent>
        <nl size="1"/>
        <xsl:apply-templates mode="RNC"/>
      </indent>
      <nl size="1"/>
      <t size="1">}</t>
    </xsl:if>
  </group>
  <xsl:call-template name="spacer"/>
  <xsl:if test="$recursive">
    <include href="{@href}" id="{generate-id ()}">
      <xsl:for-each select="document (@href)/rng:grammar">
        <xsl:call-template name="make-compact-schema"/>
      </xsl:for-each>
    </include>
  </xsl:if>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rng:externalRefRNC
Namespace No namespace
Match rng:externalRef
Mode RNC
References
Import precedence 1
Source
<xsl:template match="rng:externalRef" mode="RNC">
  <group>
    <xsl:call-template name="annotations"/>
    <keyword size="8">external</keyword>
    <sp size="1"/>
    <external-href ref="{generate-id ()}">
      <xsl:call-template name="external"/>
    </external-href>
  </group>
  <xsl:if test="$recursive">
    <external href="{@href}" id="{generate-id ()}">
      <xsl:for-each select="document (@href)">
        <xsl:call-template name="make-compact-schema"/>
      </xsl:for-each>
    </external>
  </xsl:if>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template make-inherit
Namespace No namespace
Used by
Template
References
Template
Parameters
QName Namespace
prefix No namespace
Import precedence 1
Source
<xsl:template name="make-inherit">
  <xsl:param name="prefix"/>
  <sp size="1"/>
  <keyword size="7">inherit</keyword>
  <t size="3"> = </t>
  <prefix>
    <xsl:call-template name="text">
      <xsl:with-param name="text" select="$prefix"/>
    </xsl:call-template>
  </prefix>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rewrite-suffix
Namespace No namespace
Used by
Template
References
Parameter
Parameters
QName Namespace Select
href No namespace @href
Import precedence 1
Source
<xsl:template name="rewrite-suffix">
  <xsl:param name="href" select="@href"/>
  <xsl:variable name="suffix" select="substring ($href, (string-length ($href) - 4) + 1, 4)"/>
  <xsl:choose>
    <xsl:when test="$rewrite-suffix and $suffix = '.rng'">
      <xsl:value-of select="substring ($href, 1, string-length ($href) - 4)"/>
      <xsl:text>.rnc</xsl:text>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="$href"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template external
Namespace No namespace
Used by
References
Import precedence 1
Source
<xsl:template name="external">
  <xsl:call-template name="str">
    <xsl:with-param name="text">
      <xsl:call-template name="rewrite-suffix"/>
    </xsl:with-param>
  </xsl:call-template>
  <xsl:variable name="ns" select="ancestor-or-self::*[@ns][1]/@ns"/>
  <xsl:choose>
    <xsl:when test="$has-default-ns and $ns = $default-ns"/>
    <xsl:when test="$has-local and $ns = ''">
      <xsl:call-template name="make-inherit">
        <xsl:with-param name="prefix">local</xsl:with-param>
      </xsl:call-template>
    </xsl:when>
    <xsl:when test="not($ns='')">
      <xsl:call-template name="make-inherit">
        <xsl:with-param name="prefix">
          <xsl:call-template name="get-prefix">
            <xsl:with-param name="nd" select="$ns"/>
          </xsl:call-template>
        </xsl:with-param>
      </xsl:call-template>
    </xsl:when>
    <xsl:when test="$has-default-ns">
      <xsl:call-template name="make-inherit">
        <xsl:with-param name="prefix">inh</xsl:with-param>
      </xsl:call-template>
    </xsl:when>
  </xsl:choose>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rng:refRNC
Namespace No namespace
Match rng:ref
Mode RNC
References
Import precedence 1
Source
<xsl:template match="rng:ref" mode="RNC">
  <group>
    <xsl:call-template name="annotations"/>
    <ref name="{@name}">
      <xsl:call-template name="text">
        <xsl:with-param name="text">
          <xsl:call-template name="quote-keyword">
            <xsl:with-param name="name" select="@name"/>
          </xsl:call-template>
        </xsl:with-param>
      </xsl:call-template>
    </ref>
  </group>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rng:parentRefRNC
Namespace No namespace
Match rng:parentRef
Mode RNC
References
Import precedence 1
Source
<xsl:template match="rng:parentRef" mode="RNC">
  <group>
    <xsl:call-template name="annotations"/>
    <keyword size="6">parent</keyword>
    <sp size="1"/>
    <parent-ref name="{@name}">
      <xsl:call-template name="text">
        <xsl:with-param name="text">
          <xsl:call-template name="quote-keyword">
            <xsl:with-param name="name" select="@name"/>
          </xsl:call-template>
        </xsl:with-param>
      </xsl:call-template>
    </parent-ref>
  </group>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rng:element | rng:attributeRNC
Namespace No namespace
Match rng:element | rng:attribute
Mode RNC
References
Import precedence 1
Source
<xsl:template match="rng:element | rng:attribute" mode="RNC">
  <group>
    <xsl:call-template name="annotations"/>
    <group>
      <xsl:variable name="head">
        <keyword>
          <xsl:call-template name="text">
            <xsl:with-param name="text" select="local-name (.)"/>
          </xsl:call-template>
        </keyword>
        <sp size="1"/>
        <xsl:call-template name="name-class">
          <xsl:with-param name="is-attr" select="boolean (self::rng:attribute)"/>
        </xsl:call-template>
      </xsl:variable>
      <xsl:choose>
        <xsl:when test="not (rng:*) or (count (rng:*) = 1 and not (@name))">
          <xsl:copy-of select="$head"/>
          <t size="3"> { </t>
          <atom size="4">text</atom>
          <t size="2"> }</t>
        </xsl:when>
        <xsl:otherwise>
          <xsl:call-template name="make-block">
            <xsl:with-param name="head">
              <xsl:copy-of select="$head"/>
            </xsl:with-param>
            <xsl:with-param name="body">
              <xsl:choose>
                <xsl:when test="@name">
                  <xsl:call-template name="group-body"/>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:call-template name="group-body">
                    <xsl:with-param name="patterns" select="rng:*[1]/following-sibling::rng:*"/>
                  </xsl:call-template>
                </xsl:otherwise>
              </xsl:choose>
            </xsl:with-param>
          </xsl:call-template>
        </xsl:otherwise>
      </xsl:choose>
    </group>
  </group>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template expression
Namespace No namespace
Used by
References
Parameters
QName Namespace Select
is-prefix-operator No namespace false ()
operator No namespace
Import precedence 1
Source
<xsl:template name="expression">
  <xsl:param name="operator"/>
  <xsl:param name="is-prefix-operator" select="false ()"/>
  <group>
    <xsl:call-template name="annotations"/>
    <group>
      <xsl:variable name="need-paren-rtf">
        <xsl:call-template name="need-paren"/>
      </xsl:variable>
      <xsl:variable name="need-paren" select="boolean (string ($need-paren-rtf))"/>
      <xsl:choose>
        <xsl:when test="$need-paren">
          <xsl:call-template name="make-parenthesis">
            <xsl:with-param name="body">
              <xsl:call-template name="expression-body">
                <xsl:with-param name="operator" select="$operator"/>
                <xsl:with-param name="is-prefix-operator" select="$is-prefix-operator"/>
              </xsl:call-template>
            </xsl:with-param>
          </xsl:call-template>
        </xsl:when>
        <xsl:otherwise>
          <xsl:call-template name="expression-body">
            <xsl:with-param name="operator" select="$operator"/>
            <xsl:with-param name="is-prefix-operator" select="$is-prefix-operator"/>
          </xsl:call-template>
        </xsl:otherwise>
      </xsl:choose>
    </group>
  </group>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rng:groupRNC
Namespace No namespace
Match rng:group
Mode RNC
References
Template
Import precedence 1
Source
<xsl:template match="rng:group" mode="RNC">
  <xsl:call-template name="expression">
    <xsl:with-param name="operator" select="','"/>
  </xsl:call-template>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rng:choicemake-choiceRNC
Namespace No namespace
Match rng:choice
Mode RNC
Used by
Template
References
Template
Import precedence 1
Source
<xsl:template match="rng:choice" mode="RNC" name="make-choice">
  <xsl:call-template name="expression">
    <xsl:with-param name="operator" select="'| '"/>
    <xsl:with-param name="is-prefix-operator" select="true ()"/>
  </xsl:call-template>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rng:interleaveRNC
Namespace No namespace
Match rng:interleave
Mode RNC
References
Template
Import precedence 1
Source
<xsl:template match="rng:interleave" mode="RNC">
  <xsl:call-template name="expression">
    <xsl:with-param name="operator" select="'& '"/>
    <xsl:with-param name="is-prefix-operator" select="true ()"/>
  </xsl:call-template>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rng:optionalRNC
Namespace No namespace
Match rng:optional
Mode RNC
References
Template
Import precedence 1
Source
<xsl:template match="rng:optional" mode="RNC">
  <xsl:call-template name="expression">
    <xsl:with-param name="operator" select="','"/>
  </xsl:call-template>
  <t size="1">?</t>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rng:zeroOrMoreRNC
Namespace No namespace
Match rng:zeroOrMore
Mode RNC
References
Template
Import precedence 1
Source
<xsl:template match="rng:zeroOrMore" mode="RNC">
  <xsl:call-template name="expression">
    <xsl:with-param name="operator" select="','"/>
  </xsl:call-template>
  <t size="1">*</t>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rng:oneOrMoreRNC
Namespace No namespace
Match rng:oneOrMore
Mode RNC
References
Template
Import precedence 1
Source
<xsl:template match="rng:oneOrMore" mode="RNC">
  <xsl:call-template name="expression">
    <xsl:with-param name="operator" select="','"/>
  </xsl:call-template>
  <t size="1">+</t>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rng:textRNC
Namespace No namespace
Match rng:text
Mode RNC
References
Template
Import precedence 1
Source
<xsl:template match="rng:text" mode="RNC">
  <group>
    <xsl:call-template name="annotations"/>
    <atom size="4">text</atom>
  </group>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rng:emptyRNC
Namespace No namespace
Match rng:empty
Mode RNC
References
Template
Import precedence 1
Source
<xsl:template match="rng:empty" mode="RNC">
  <group>
    <xsl:call-template name="annotations"/>
    <atom size="5">empty</atom>
  </group>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rng:notAllowedRNC
Namespace No namespace
Match rng:notAllowed
Mode RNC
References
Template
Import precedence 1
Source
<xsl:template match="rng:notAllowed" mode="RNC">
  <group>
    <xsl:call-template name="annotations"/>
    <atom size="10">notAllowed</atom>
  </group>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rng:dataRNC
Namespace No namespace
Match rng:data
Mode RNC
References
Import precedence 1
Source
<xsl:template match="rng:data" mode="RNC">
  <group>
    <xsl:call-template name="annotations"/>
    <group>
      <xsl:call-template name="type-name"/>
      <xsl:if test="rng:param">
        <nl size="1"/>
        <t size="1">{</t>
        <indent>
          <xsl:for-each select="rng:param">
            <nl size="1"/>
            <group>
              <xsl:call-template name="annotations"/>
              <param>
                <xsl:call-template name="text">
                  <xsl:with-param name="text" select="@name"/>
                </xsl:call-template>
              </param>
              <t size="3"> = </t>
              <xsl:call-template name="make-string-literal"/>
            </group>
          </xsl:for-each>
        </indent>
        <nl size="1"/>
        <t size="1">}</t>
      </xsl:if>
      <xsl:for-each select="rng:except">
        <nl size="1"/>
        <t size="1">-</t>
        <nl size="1"/>
        <xsl:choose>
          <xsl:when test="count (rng:*) > 1">
            <xsl:call-template name="make-choice"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:apply-templates select="*" mode="RNC"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:for-each>
    </group>
  </group>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rng:valueRNC
Namespace No namespace
Match rng:value
Mode RNC
References
Import precedence 1
Source
<xsl:template match="rng:value" mode="RNC">
  <group>
    <xsl:call-template name="annotations"/>
    <xsl:variable name="type">
      <xsl:call-template name="type-name"/>
    </xsl:variable>
    <xsl:if test="$type != 'token'">
      <xsl:copy-of select="$type"/>
      <sp size="1"/>
    </xsl:if>
    <xsl:call-template name="make-string-literal"/>
  </group>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template quote-quotes
Namespace No namespace
Used by
References
Template
Parameters
QName Namespace Select
pos No namespace 1
str No namespace
Import precedence 1
Source
<xsl:template name="quote-quotes">
  <xsl:param name="str"/>
  <xsl:param name="pos" select="1"/>
  <xsl:variable name="c" select="substring ($str, $pos, 1)"/>
  <xsl:if test="$c">
    <xsl:choose>
      <xsl:when test="$c = '"'">" '"' "</xsl:when>
      <xsl:when test="$c = '
'">\x{A}</xsl:when>
      <xsl:when test="$c = '
'">\x{D}</xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$c"/>
      </xsl:otherwise>
    </xsl:choose>
    <xsl:call-template name="quote-quotes">
      <xsl:with-param name="str" select="$str"/>
      <xsl:with-param name="pos" select="$pos + 1"/>
    </xsl:call-template>
  </xsl:if>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template make-string-literal
Namespace No namespace
Used by
References
Templates
Import precedence 1
Source
<xsl:template name="make-string-literal">
  <xsl:choose>
    <xsl:when test="not (contains (., '"') or   contains (., "'") or   contains (., '
') or contains (., '
'))">
      <xsl:call-template name="str">
        <xsl:with-param name="text" select="."/>
      </xsl:call-template>
    </xsl:when>
    <xsl:when test="not (contains (., '"""'))">
      <xsl:call-template name="str">
        <xsl:with-param name="quote" select="'"""'"/>
        <xsl:with-param name="text" select="."/>
        <xsl:with-param name="is-multiline" select="true ()"/>
      </xsl:call-template>
    </xsl:when>
    <xsl:when test="not (contains (., "'''"))">
      <xsl:call-template name="str">
        <xsl:with-param name="quote">'''</xsl:with-param>
        <xsl:with-param name="text" select="."/>
        <xsl:with-param name="is-multiline" select="true ()"/>
      </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
      <xsl:call-template name="str">
        <xsl:with-param name="text">
          <xsl:call-template name="quote-quotes">
            <xsl:with-param name="str" select="."/>
          </xsl:call-template>
        </xsl:with-param>
      </xsl:call-template>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template type-name
Namespace No namespace
Used by
References
Template
Variable
Import precedence 1
Source
<xsl:template name="type-name">
  <xsl:variable name="dt" select="ancestor-or-self::rng:*[@datatypeLibrary][1]/@datatypeLibrary"/>
  <xsl:variable name="dts" select="string ($dt)"/>
  <type>
    <xsl:call-template name="text">
      <xsl:with-param name="text">
        <xsl:choose>
          <xsl:when test="self::rng:value and not (@type)">token</xsl:when>
          <xsl:when test="$dts = '' and @type= 'string'">string</xsl:when>
          <xsl:when test="$dts = '' and @type= 'token'">token</xsl:when>
          <xsl:when test="$dts = ''">
            <xsl:text>xsd:</xsl:text>
            <xsl:value-of select="@type"/>
          </xsl:when>
          <xsl:when test="$dts = $xsd">
            <xsl:text>xsd:</xsl:text>
            <xsl:value-of select="@type"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="generate-id ($dt)"/>
            <xsl:text>:</xsl:text>
            <xsl:value-of select="@type"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:with-param>
    </xsl:call-template>
  </type>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template need-paren
Namespace No namespace
Used by
Template
Import precedence 1
Source
<xsl:template name="need-paren">
  <xsl:choose>
    <xsl:when test="self::rng:optional or  self::rng:zeroOrMore or  self::rng:oneOrMore">
      <xsl:if test="count (rng:*) > 1">true</xsl:if>
    </xsl:when>
    <xsl:when test="parent::rng:element[not (@name)] or   parent::rng:attribute [not (@name)]">
      <xsl:if test="count (../rng:*) > 2">true</xsl:if>
    </xsl:when>
    <xsl:when test="count (../rng:*) > 1">true</xsl:when>
    <xsl:when test="count (rng:*) > 1 and (parent::rng:optional or   parent::rng:zeroOrMore or parent::rng:oneOrMore)">true</xsl:when>
  </xsl:choose>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template expression-body
Namespace No namespace
Used by
Templates
References
Parameters
QName Namespace Select
is-prefix-operator No namespace false ()
operator No namespace
patterns No namespace rng:*
Import precedence 1
Source
<xsl:template name="expression-body">
  <xsl:param name="patterns" select="rng:*"/>
  <xsl:param name="operator"/>
  <xsl:param name="is-prefix-operator" select="false ()"/>
  <xsl:choose>
    <xsl:when test="$is-prefix-operator">
      <xsl:for-each select="$patterns">
        <xsl:if test="position () != 1">
          <nl size="1"/>
          <op size="{string-length ($operator)}">
            <xsl:value-of select="$operator"/>
          </op>
        </xsl:if>
        <xsl:apply-templates select="." mode="RNC"/>
        <xsl:call-template name="follow-annotations"/>
      </xsl:for-each>
    </xsl:when>
    <xsl:otherwise>
      <xsl:for-each select="$patterns">
        <xsl:if test="position () != 1">
          <op size="{string-length ($operator)}">
            <xsl:value-of select="$operator"/>
          </op>
          <nl size="1"/>
        </xsl:if>
        <xsl:apply-templates select="." mode="RNC"/>
        <xsl:call-template name="follow-annotations"/>
      </xsl:for-each>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template group-body
Namespace No namespace
Used by
References
Template
Parameters
QName Namespace Select
patterns No namespace rng:*
Import precedence 1
Source
<xsl:template name="group-body">
  <xsl:param name="patterns" select="rng:*"/>
  <xsl:call-template name="expression-body">
    <xsl:with-param name="patterns" select="$patterns"/>
    <xsl:with-param name="operator" select="','"/>
  </xsl:call-template>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template name-class
Namespace No namespace
Used by
References
Templates
Parameters
QName Namespace Select
is-attr No namespace false ()
Import precedence 1
Source
<xsl:template name="name-class">
  <xsl:param name="is-attr" select="false ()"/>
  <nc>
    <xsl:call-template name="text">
      <xsl:with-param name="text">
        <xsl:choose>
          <xsl:when test="@name">
            <xsl:choose>
              <xsl:when test="not ($is-attr) and not (contains (@name, ':'))">
                <xsl:call-template name="make-name-nc">
                  <xsl:with-param name="name" select="@name"/>
                  <xsl:with-param name="is-attr" select="false ()"/>
                </xsl:call-template>
              </xsl:when>
              <xsl:when test="@ns">
                <xsl:text>[</xsl:text>
                <xsl:value-of select="@ns"/>
                <xsl:text>]</xsl:text>
                <xsl:value-of select="@name"/>
              </xsl:when>
              <xsl:otherwise>
                <xsl:value-of select="@name"/>
              </xsl:otherwise>
            </xsl:choose>
          </xsl:when>
          <xsl:otherwise>
            <xsl:apply-templates select="rng:*[1]" mode="name-class">
              <xsl:with-param name="is-attr" select="$is-attr"/>
            </xsl:apply-templates>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:with-param>
    </xsl:call-template>
  </nc>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rng:namename-class
Namespace No namespace
Match rng:name
Mode name-class
References
Template
Parameters
QName Namespace
is-attr No namespace
Import precedence 1
Source
<xsl:template match="rng:name" mode="name-class">
  <xsl:param name="is-attr"/>
  <xsl:call-template name="make-name-nc">
    <xsl:with-param name="name" select="."/>
    <xsl:with-param name="is-attr" select="$is-attr"/>
  </xsl:call-template>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rng:nsNamename-class
Namespace No namespace
Match rng:nsName
Mode name-class
References
Parameters
QName Namespace
is-attr No namespace
Import precedence 1
Source
<xsl:template match="rng:nsName" mode="name-class">
  <xsl:param name="is-attr"/>
  <xsl:variable name="ns" select="ancestor-or-self::rng:*[@ns][1]/@ns"/>
  <xsl:choose>
    <xsl:when test="$has-default-ns and $ns = $default-ns">
      <xsl:value-of select="$default-ns-id"/>
    </xsl:when>
    <xsl:when test="$has-local and $ns = ''">local</xsl:when>
    <xsl:when test="not($ns='')">
      <xsl:call-template name="get-prefix">
        <xsl:with-param name="nd" select="$ns"/>
      </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
      <xsl:text>inh</xsl:text>
    </xsl:otherwise>
  </xsl:choose>
  <xsl:text>:*</xsl:text>
  <xsl:call-template name="nc-except">
    <xsl:with-param name="is-attr" select="$is-attr"/>
  </xsl:call-template>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rng:anyNamename-class
Namespace No namespace
Match rng:anyName
Mode name-class
References
Template
Parameters
QName Namespace
is-attr No namespace
Import precedence 1
Source
<xsl:template match="rng:anyName" mode="name-class">
  <xsl:param name="is-attr"/>
  <xsl:text>*</xsl:text>
  <xsl:call-template name="nc-except">
    <xsl:with-param name="is-attr" select="$is-attr"/>
  </xsl:call-template>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template nc-except
Namespace No namespace
Used by
References
Template
Parameters
QName Namespace
is-attr No namespace
Import precedence 1
Source
<xsl:template name="nc-except">
  <xsl:param name="is-attr"/>
  <xsl:for-each select="rng:except">
    <xsl:text> - </xsl:text>
    <xsl:choose>
      <xsl:when test="count (rng:*) > 1">
        <xsl:text>(</xsl:text>
        <xsl:call-template name="make-nc-choice">
          <xsl:with-param name="is-attr" select="$is-attr"/>
        </xsl:call-template>
        <xsl:text>)</xsl:text>
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates select="rng:*" mode="name-class">
          <xsl:with-param name="is-attr" select="$is-attr"/>
        </xsl:apply-templates>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rng:attribute/rng:choice | rng:element/rng:choicemake-nc-choicename-class
Namespace No namespace
Match rng:attribute/rng:choice | rng:element/rng:choice
Mode name-class
Used by
Parameters
QName Namespace
is-attr No namespace
Import precedence 1
Source
<xsl:template match="rng:attribute/rng:choice | rng:element/rng:choice" mode="name-class" name="make-nc-choice">
  <xsl:param name="is-attr"/>
  <xsl:for-each select="rng:*">
    <xsl:if test="position () != 1">
      <xsl:text> | </xsl:text>
    </xsl:if>
    <xsl:apply-templates select="." mode="name-class">
      <xsl:with-param name="is-attr" select="$is-attr"/>
    </xsl:apply-templates>
  </xsl:for-each>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rng:choicename-class
Namespace No namespace
Match rng:choice
Mode name-class
References
Template
Parameters
QName Namespace
is-attr No namespace
Import precedence 1
Source
<xsl:template match="rng:choice" mode="name-class">
  <xsl:param name="is-attr"/>
  <xsl:text>(</xsl:text>
  <xsl:call-template name="make-nc-choice">
    <xsl:with-param name="is-attr" select="$is-attr"/>
  </xsl:call-template>
  <xsl:text>)</xsl:text>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template make-name-nc
Namespace No namespace
Used by
References
Variables
Parameter
Template
Parameters
QName Namespace
is-attr No namespace
name No namespace
Import precedence 1
Source
<xsl:template name="make-name-nc">
  <xsl:param name="is-attr"/>
  <xsl:param name="name"/>
  <xsl:variable name="ns" select="ancestor-or-self::rng:*[@ns][1]/@ns"/>
  <xsl:choose>
    <xsl:when test="not ($is-attr) and $has-default-ns and  $ns = $default-ns"/>
    <xsl:when test="$is-attr and $ns = ''"/>
    <xsl:when test="$is-attr and not($default-ns-id='') and $has-default-ns and $ns = $default-ns">
      <xsl:value-of select="$default-ns-id"/>
      <xsl:text>:</xsl:text>
    </xsl:when>
    <xsl:when test="string-length($ns)>0">
      <xsl:call-template name="get-prefix">
        <xsl:with-param name="nd" select="$ns"/>
      </xsl:call-template>
      <xsl:text>:</xsl:text>
    </xsl:when>
    <!--
      <xsl:when test="$is-attr or $has-default-ns">
        <xsl:text>inh:</xsl:text>
      </xsl:when>
-->
  </xsl:choose>
  <xsl:value-of select="$name"/>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template last-token
Namespace No namespace
Used by
References
Template
Parameters
QName Namespace Select
pos No namespace string-length ($str)
str No namespace
Import precedence 1
Source
<xsl:template name="last-token">
  <xsl:param name="str"/>
  <xsl:param name="pos" select="string-length ($str)"/>
  <xsl:choose>
    <xsl:when test="$pos = 0">
      <xsl:value-of select="$str"/>
    </xsl:when>
    <xsl:when test="substring ($str, $pos, 1) = ' '">
      <xsl:value-of select="substring ($str, $pos + 1)"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:call-template name="last-token">
        <xsl:with-param name="str" select="$str"/>
        <xsl:with-param name="pos" select="$pos - 1"/>
      </xsl:call-template>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template mapped-prefix
Namespace No namespace
Used by
References
Variable
Template
Parameter
Parameters
QName Namespace
ns No namespace
Import precedence 1
Source
<xsl:template name="mapped-prefix">
  <xsl:param name="ns"/>
  <xsl:variable name="simple-mapped" select="substring-before ($simple-prefix-map, concat ('=', $ns, ' '))"/>
  <xsl:choose>
    <xsl:when test="$simple-mapped">
      <xsl:call-template name="last-token">
        <xsl:with-param name="str" select="$simple-mapped"/>
      </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
      <xsl:variable name="mapped" select="$prefix-map [string (.) = $ns][1]"/>
      <xsl:if test="$mapped">
        <xsl:value-of select="$mapped/@prefix"/>
      </xsl:if>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template get-prefix
Namespace No namespace
Used by
References
Template
Parameter
Key
Parameters
QName Namespace Select
nd No namespace .
Import precedence 1
Source
<xsl:template name="get-prefix">
  <xsl:param name="nd" select="."/>
  <xsl:variable name="ns" select="string ($nd)"/>
  <xsl:variable name="mapped">
    <xsl:call-template name="mapped-prefix">
      <xsl:with-param name="ns" select="$ns"/>
    </xsl:call-template>
  </xsl:variable>
  <xsl:choose>
    <xsl:when test="string ($mapped)">
      <xsl:value-of select="$mapped"/>
    </xsl:when>
    <xsl:when test="not ($retain-prefixes)">
      <xsl:value-of select="generate-id ($nd)"/>
    </xsl:when>
    <xsl:when test="key ('ns', $ns)">
      <xsl:variable name="pfx" select="name ( (key ('ns', $ns)/namespace::*[. = $ns])[1] )"/>
      <xsl:choose>
        <xsl:when test="$pfx">
          <xsl:value-of select="$pfx"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="generate-id (key ('ns', $ns)[1])"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="generate-id ($nd)"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template spacer
Namespace No namespace
Used by
Import precedence 1
Source
<xsl:template name="spacer">
  <xsl:if test="following-sibling::*">
    <nl size="1"/>
    <xsl:if test="not (parent::rng:include) and  not (parent::rng:grammar/../..) and   not (self::rng:include and   following-sibling::*[1][self::rng:include])">
      <nl size="1"/>
    </xsl:if>
  </xsl:if>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template quote-keyword
Namespace No namespace
Used by
References
Variable
Parameters
QName Namespace
name No namespace
Import precedence 1
Source
<xsl:template name="quote-keyword">
  <xsl:param name="name"/>
  <xsl:if test="$name = $keywords">\</xsl:if>
  <xsl:value-of select="$name"/>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template leading-documentation
Namespace No namespace
Parameters
QName Namespace
nd No namespace
Import precedence 1
Source
<xsl:template name="leading-documentation">
  <xsl:param name="nd"/>
  <!--
    <xsl:choose>
      <xsl:when test="not ($nd) or $nd/self::rng:*"/>

      <xsl:when test="$nd/self::a:documentation">
	<xsl:call-template name="doc-comment">
	  <xsl:with-param name="comment" select="string ($nd)"/>
	</xsl:call-template>
	<nl size="1"/>
	<xsl:call-template name="leading-documentation">
	  <xsl:with-param name="nd" select="$nd/following-sibling::*[1]"/>
	</xsl:call-template>
      </xsl:when>

      <xsl:otherwise>
	<group>
	  <t size="1">[</t>
	  <indent>
	    <xsl:call-template name="annotation-attributes"/>

	    <xsl:call-template name="leading-annotations">
	      <xsl:with-param name="nd" select="$nd"/>
	    </xsl:call-template>
	  </indent>
	  <nl size="1"/>
	  <t size="1">]</t>
	</group>
	<nl size="1"/>
      </xsl:otherwise>
    </xsl:choose>
-->
</xsl:template>
Stylesheet location RngToRnc.xsl
Template leading-annotations
Namespace No namespace
Used by
References
Parameters
QName Namespace
nd No namespace
Import precedence 1
Source
<xsl:template name="leading-annotations">
  <xsl:param name="nd"/>
  <xsl:if test="$nd and not ($nd/self::rng:*)">
    <xsl:for-each select="$nd">
      <xsl:call-template name="annotation-element"/>
    </xsl:for-each>
    <xsl:call-template name="leading-annotations">
      <xsl:with-param name="nd" select="$nd/following-sibling::*[1]"/>
    </xsl:call-template>
  </xsl:if>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template annotations
Namespace No namespace
Used by
Import precedence 1
Source
<xsl:template name="annotations">
  <!--
    <xsl:choose>
      <xsl:when test="(self::rng:value or self::rng:param) and
	following-sibling::*[1][not (self::rng:*)]">
	<xsl:call-template name="leading-documentation">
	  <xsl:with-param name="nd" select="following-sibling::*[1]"/>
	</xsl:call-template>
      </xsl:when>
      <xsl:when test="*[1][not (self::rng:*)]">
	<xsl:call-template name="leading-documentation">
	  <xsl:with-param name="nd" select="*[1]"/>
	</xsl:call-template>
      </xsl:when>
      <xsl:when test="@*[namespace-uri () != '']">
	<group>
	  <t size="1">[</t>
	  <indent>
	    <xsl:call-template name="annotation-attributes"/>
	  </indent>
	  <nl size="1"/>
	  <t size="1">]</t>
	</group>
	<nl size="1"/>
      </xsl:when>
    </xsl:choose>
-->
</xsl:template>
Stylesheet location RngToRnc.xsl
Template doc-comment
Namespace No namespace
Parameters
QName Namespace
comment No namespace
Import precedence 1
Source
<xsl:template name="doc-comment">
  <xsl:param name="comment"/>
  <!--
    <xsl:if test="$comment">
      <xsl:variable name="head" select="substring-before ($comment, '&#10;')"/>
      <xsl:variable name="line">
	<xsl:text>## </xsl:text>
	<xsl:choose>
	  <xsl:when test="$head">
	    <xsl:value-of select="$head"/>
	  </xsl:when>
	  <xsl:otherwise>
	    <xsl:value-of select="$comment"/>
	  </xsl:otherwise>
	</xsl:choose>
      </xsl:variable>
      
      <doc>
	<xsl:call-template name="text">
	  <xsl:with-param name="text" select="$line"/>
	</xsl:call-template>
      </doc>
      <nl size="1"/>
      <xsl:call-template name="doc-comment">
	<xsl:with-param name="comment"
	  select="substring-after ($comment, '&#10;')"/>
      </xsl:call-template>
    </xsl:if>
-->
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rng:grammar/a:documentation | rng:div/a:documentation | rng:include/a:documentation
Namespace No namespace
Match rng:grammar/a:documentation | rng:div/a:documentation | rng:include/a:documentation
Mode #default
References
Import precedence 1
Priority -15
Source
<xsl:template match="rng:grammar/a:documentation | rng:div/a:documentation |     rng:include/a:documentation" priority="-15">
  <xsl:if test="not (../../..) or        preceding-sibling::*[not (self::a:documentation)]">
    <xsl:call-template name="annotation-element"/>
  </xsl:if>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rng:grammar/* | rng:div/* | rng:include/*
Namespace No namespace
Match rng:grammar/* | rng:div/* | rng:include/*
Mode #default
References
Import precedence 1
Priority -20
Source
<xsl:template match="rng:grammar/* | rng:div/* | rng:include/*" priority="-20">
  <xsl:call-template name="annotation-element"/>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template follow-annotations
Namespace No namespace
Used by
References
Parameters
QName Namespace Select
nd No namespace self::*[not (self::rng:value or self::rng:param)] /following-sibling::*[1][not (self::rng:*)]
Import precedence 1
Source
<xsl:template name="follow-annotations">
  <xsl:param name="nd" select="self::*[not (self::rng:value or self::rng:param)]       /following-sibling::*[1][not (self::rng:*)]"/>
  <xsl:if test="$nd">
    <xsl:for-each select="$nd">
      <nl size="1"/>
      <xsl:call-template name="follow-annotation"/>
      <xsl:call-template name="follow-annotations"/>
    </xsl:for-each>
  </xsl:if>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rng:*follow-annotation
Namespace No namespace
Match rng:*
Mode #default
Used by
References
Import precedence 1
Priority -100
Source
<xsl:template match="rng:*" priority="-100" name="follow-annotation">
  <xsl:if test="preceding-sibling::rng:*">
    <t size="2">>></t>
    <xsl:call-template name="annotation-element"/>
  </xsl:if>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template annotation-name
Namespace No namespace
Used by
References
Templates
Parameter
Keys
Import precedence 1
Source
<xsl:template name="annotation-name">
  <annot>
    <xsl:call-template name="text">
      <xsl:with-param name="text">
        <xsl:variable name="ns" select="namespace-uri (.)"/>
        <xsl:if test="not($ns='')">
          <xsl:variable name="mapped">
            <xsl:call-template name="mapped-prefix">
              <xsl:with-param name="ns" select="$ns"/>
            </xsl:call-template>
          </xsl:variable>
          <xsl:choose>
            <xsl:when test="string ($mapped)">
              <xsl:value-of select="$mapped"/>
            </xsl:when>
            <xsl:when test="$retain-prefixes">
              <xsl:variable name="pfx" select="name ( (key ('ns', $ns)/namespace::*[. = $ns])[1] )"/>
              <xsl:choose>
                <xsl:when test="$pfx">
                  <xsl:value-of select="$pfx"/>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:value-of select="generate-id (key ('ns', $ns)[1])"/>
                </xsl:otherwise>
              </xsl:choose>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="generate-id (key ('annot-ns', $ns)[1])"/>
            </xsl:otherwise>
          </xsl:choose>
          <xsl:text>:</xsl:text>
        </xsl:if>
        <xsl:value-of select="local-name (.)"/>
      </xsl:with-param>
    </xsl:call-template>
  </annot>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template annotation-attributes
Namespace No namespace
References
Import precedence 1
Source
<xsl:template name="annotation-attributes">
  <xsl:for-each select="@*[namespace-uri () != '']">
    <nl size="1"/>
    <xsl:call-template name="annotation-name"/>
    <t size="3"> = </t>
    <xsl:call-template name="make-string-literal"/>
  </xsl:for-each>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template rng:*annotation-elementannot
Namespace No namespace
Match rng:*
Mode annot
Used by
References
Import precedence 1
Source
<xsl:template match="rng:*" name="annotation-element" mode="annot">
  <nl size="1"/>
  <group>
    <xsl:call-template name="annotation-name"/>
    <nl size="1"/>
    <t size="1">[</t>
    <indent>
      <xsl:for-each select="@*">
        <nl size="1"/>
        <xsl:call-template name="annotation-name"/>
        <t size="3"> = </t>
        <xsl:call-template name="make-string-literal"/>
      </xsl:for-each>
      <xsl:apply-templates mode="annot"/>
    </indent>
    <nl size="1"/>
    <t size="1">]</t>
  </group>
  <xsl:if test="following-sibling::*">
    <xsl:if test="parent::rng:grammar or parent::rng:div or   parent::rng:include">
      <nl size="1"/>
      <xsl:if test="following-sibling::*[1][self::rng:*]">
        <nl size="1"/>
      </xsl:if>
    </xsl:if>
  </xsl:if>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template text ()annot
Namespace No namespace
Match text ()
Mode annot
References
Import precedence 1
Source
<xsl:template match="text ()" mode="annot">
  <nl size="1"/>
  <xsl:call-template name="make-string-literal"/>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template make-body-from-r-t-f
Namespace No namespace
References
Template
Parameters
QName Namespace
schema No namespace
Import precedence 1
Source
<xsl:template name="make-body-from-r-t-f">
  <xsl:param name="schema"/>
  <xsl:for-each select="$schema">
    <xsl:call-template name="make-body"/>
  </xsl:for-each>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template make-body
Namespace No namespace
Used by
Import precedence 1
Source
<xsl:template name="make-body">
  <xsl:apply-templates mode="keep"/>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template groupkeep
Namespace No namespace
Match group
Mode keep
References
Import precedence 1
Source
<xsl:template match="group" mode="keep">
  <xsl:choose>
    <xsl:when test="  not ($collapse-lines) or   @collapse = 'no' or  .//doc or   .//group [@collapse = 'no']">
      <xsl:apply-templates mode="keep"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:variable name="size" select="sum (.//*/@size)"/>
      <xsl:variable name="level" select="count (ancestor::indent)"/>
      <xsl:choose>
        <xsl:when test="$line-width > ($size + ($level * $indent-width))">
          <xsl:apply-templates mode="flatten"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:apply-templates mode="keep"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template spkeep
Namespace No namespace
Match sp
Mode keep
Import precedence 1
Source
<xsl:template match="sp" mode="keep">
  <xsl:text> </xsl:text>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template nlkeep
Namespace No namespace
Match nl
Mode keep
References
Variable
Parameter
Import precedence 1
Source
<xsl:template match="nl" mode="keep">
  <xsl:text>
</xsl:text>
  <xsl:variable name="level" select="count (ancestor::indent)"/>
  <xsl:variable name="following-op" select="following-sibling::*[1][self::op]"/>
  <xsl:choose>
    <xsl:when test="$following-op">
      <xsl:value-of select="substring ($spaces, 1,     $level * $indent-width - $following-op/@size)"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="substring ($spaces, 1, $level * $indent-width)"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template sp | nlflatten
Namespace No namespace
Match sp | nl
Mode flatten
Import precedence 1
Source
<xsl:template match="sp | nl" mode="flatten">
  <xsl:text> </xsl:text>
</xsl:template>
Stylesheet location RngToRnc.xsl
Template refflatten
Namespace No namespace
Match ref
Mode flatten
References
Parameter
Template
Import precedence 1
Source
<xsl:template match="ref" mode="flatten">
  <xsl:variable name="me">
    <xsl:choose>
      <xsl:when test="contains(@name,'.attributes')">
        <xsl:value-of select="substring-before(@name,'.attributes')"/>
      </xsl:when>
      <xsl:when test="contains(@name,'.content')">
        <xsl:value-of select="substring-before(.,'.content')"/>
      </xsl:when>
      <xsl:when test="contains(@name,'.attribute.')">
        <xsl:value-of select="substring-before(@name,'.attribute.')"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="@name"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <!--
<xsl:message>FROM <xsl:value-of select="@name"/> to <xsl:value-of
    select="$me"/>, <xsl:for-each select="$top"><xsl:value-of 
select="count(key('IDENTS',$me))"/></xsl:for-each></xsl:message>
-->
  <xsl:variable name="n" select="@name"/>
  <xsl:choose>
    <xsl:when test="contains(.,'.localattributes')">
      <xsl:value-of select="$n"/>
    </xsl:when>
    <xsl:when test="contains(@name,'.content')">
      <xsl:value-of select="$n"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:for-each select="$top">
        <xsl:call-template name="linkTogether">
          <xsl:with-param name="name">
            <xsl:value-of select="$me"/>
          </xsl:with-param>
          <xsl:with-param name="reftext">
            <xsl:value-of select="$n"/>
          </xsl:with-param>
        </xsl:call-template>
      </xsl:for-each>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
Stylesheet location RngToRnc.xsl
Parameter top
Namespace No namespace
Used by
Template
Source
<xsl:param name="top"/>
Stylesheet location RngToRnc.xsl
Parameter collapse-lines
Namespace No namespace
Select true ()
Used by
Template
Source
<xsl:param name="collapse-lines" select="true ()"/>
Stylesheet location RngToRnc.xsl
Parameter indent-width
Namespace No namespace
Select 3
Used by
Templates
Source
<xsl:param name="indent-width" select="3"/>
Stylesheet location RngToRnc.xsl
Parameter line-width
Namespace No namespace
Select 80
Used by
Template
Source
<xsl:param name="line-width" select="80"/>
Stylesheet location RngToRnc.xsl
Parameter rewrite-suffix
Namespace No namespace
Select true ()
Used by
Template
Source
<xsl:param name="rewrite-suffix" select="true ()"/>
Stylesheet location RngToRnc.xsl
Parameter retain-prefixes
Namespace No namespace
Select system-property ('xsl:vendor') != 'Microsoft' and not (starts-with (system-property ('xsl:vendor'), 'Apache'))
Used by
Source
<xsl:param name="retain-prefixes" select="system-property ('xsl:vendor') != 'Microsoft' and     not (starts-with (system-property ('xsl:vendor'), 'Apache'))"/>
Stylesheet location RngToRnc.xsl
Parameter default-ns
Namespace No namespace
Select string (/descendant::rng:*[@ns][1]/@ns)
Used by
Source
<xsl:param name="default-ns" select="string (/descendant::rng:*[@ns][1]/@ns)"/>
Stylesheet location RngToRnc.xsl
Parameter prefixes
Namespace No namespace
Used by
Source
<xsl:param name="prefixes"/>
Stylesheet location RngToRnc.xsl
Parameter prefix-map
Namespace No namespace
Select /..
Used by
Template
Source
<xsl:param name="prefix-map" select="/.."/>
Stylesheet location RngToRnc.xsl
Parameter recursive
Namespace No namespace
Select false ()
Used by
Source
<xsl:param name="recursive" select="false ()"/>
Stylesheet location RngToRnc.xsl
Variable xsd
Namespace No namespace
Select 'http://www.w3.org/2001/XMLSchema-datatypes'
Used by
Template
Source
<xsl:variable name="xsd" select="'http://www.w3.org/2001/XMLSchema-datatypes'"/>
Stylesheet location RngToRnc.xsl
Variable default-ns-nd
Namespace No namespace
Select /descendant::rng:*[@ns = $default-ns][1]/@ns
Used by
References
Parameter
Source
<xsl:variable name="default-ns-nd" select="/descendant::rng:*[@ns = $default-ns][1]/@ns"/>
Stylesheet location RngToRnc.xsl
Variable default-ns-id-rtf
Namespace No namespace
Used by
Variable
References
Template
Variable
Source
<xsl:variable name="default-ns-id-rtf">
  <xsl:call-template name="get-prefix">
    <xsl:with-param name="nd" select="$default-ns-nd"/>
  </xsl:call-template>
</xsl:variable>
Stylesheet location RngToRnc.xsl
Variable default-ns-id
Namespace No namespace
Select string ($default-ns-id-rtf)
Used by
References
Source
<xsl:variable name="default-ns-id" select="string ($default-ns-id-rtf)"/>
Stylesheet location RngToRnc.xsl
Variable has-default-ns
Namespace No namespace
Select boolean ($default-ns-nd)
Used by
References
Variable
Source
<xsl:variable name="has-default-ns" select="boolean ($default-ns-nd)"/>
Stylesheet location RngToRnc.xsl
Variable has-local
Namespace No namespace
Select not (key ('prefix', 'local'))
Used by
References
Key
Source
<xsl:variable name="has-local" select="not (key ('prefix', 'local'))"/>
Stylesheet location RngToRnc.xsl
Variable simple-prefix-map
Namespace No namespace
Select concat (' ', $prefixes, ' ')
Used by
Template
References
Parameter
Source
<xsl:variable name="simple-prefix-map" select="concat (' ', $prefixes, ' ')"/>
Stylesheet location RngToRnc.xsl
Variable keywords
Namespace No namespace
Select document ('')/*/foo:keywords/*
Used by
Template
Source
<xsl:variable xmlns:foo="http://www.example.com" name="keywords" select="document ('')/*/foo:keywords/*"/>
Stylesheet location RngToRnc.xsl
Variable spaces
Namespace No namespace
Select concat ( ' ', ' ' )
Used by
Template
Source
<xsl:variable name="spaces" select="concat (     '                                        ',     '                                        '     )"/>
Stylesheet location RngToRnc.xsl
Output (default)
Namespace No namespace
Output properties
method indent
yes
Source
<xsl:output method="xml" indent="yes"/>
Stylesheet location RngToRnc.xsl
Key prefix
Namespace No namespace
Match rng:element/@name [contains (., ':')] | rng:attribute/@name [contains (., ':')]
Use substring-before (., ':')
Used by
Variable
Source
<xsl:key name="prefix" match="rng:element/@name [contains (., ':')] | rng:attribute/@name [contains (., ':')]" use="substring-before (., ':')"/>
Stylesheet location RngToRnc.xsl
Key ns
Namespace No namespace
Match *
Use namespace::*
Used by
Source
<xsl:key name="ns" match="*" use="namespace::*"/>
Stylesheet location RngToRnc.xsl
Key annot-ns
Namespace No namespace
Match @*[namespace-uri (.) != '']
Use namespace-uri (.)
Used by
Template
Source
<xsl:key name="annot-ns" match="@*[namespace-uri (.) != '']" use="namespace-uri (.)"/>
Stylesheet location RngToRnc.xsl