diff options
author | Shaun McCance <shaunm@gnome.org> | 2011-05-05 20:01:24 -0400 |
---|---|---|
committer | Shaun McCance <shaunm@gnome.org> | 2011-05-05 20:01:24 -0400 |
commit | ad40d353782b022398e8fad31b494f6a4daad808 (patch) | |
tree | 3bea902825b020b93173231c95460059b3523740 /xslt | |
parent | 49ebec275f14f7ad81dcbcc9429b65bbfce00e06 (diff) | |
download | yelp-tools-ad40d353782b022398e8fad31b494f6a4daad808.tar.gz |
mal-rng.xsl: Exclude non-combine start from non-first
Diffstat (limited to 'xslt')
-rw-r--r-- | xslt/mal-rng.xsl | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/xslt/mal-rng.xsl b/xslt/mal-rng.xsl index bc75c4d..e80e44c 100644 --- a/xslt/mal-rng.xsl +++ b/xslt/mal-rng.xsl @@ -60,8 +60,10 @@ <xsl:variable name="nss" select="exsl:node-set($nss_)/*[not(@ns = preceding-sibling::*/@ns)]"/> <grammar> <xsl:for-each select="str:split($uris)"> + <xsl:variable name="first" select="position() = 1"/> <xsl:for-each select="document(.)/rng:grammar"> <xsl:apply-templates mode="rng.mode" select="*"> + <xsl:with-param name="first" select="$first"/> <xsl:with-param name="ns" select="string(@ns)"/> <xsl:with-param name="nss" select="$nss"/> </xsl:apply-templates> @@ -75,6 +77,7 @@ </xsl:template> <xsl:template mode="rng.mode" match="*"> + <xsl:param name="first"/> <xsl:param name="ns"/> <xsl:param name="nss"/> <xsl:variable name="nsmunge" select="self::rng:element or self::rng:attribute"/> @@ -107,13 +110,33 @@ </xsl:choose> </xsl:if> <xsl:apply-templates mode="rng.mode"> + <xsl:with-param name="first" select="$first"/> <xsl:with-param name="ns" select="$ns"/> <xsl:with-param name="nss" select="$nss"/> </xsl:apply-templates> </xsl:copy> </xsl:template> +<xsl:template mode="rng.mode" match="rng:start"> + <xsl:param name="first"/> + <xsl:param name="ns"/> + <xsl:param name="nss"/> + <xsl:if test="$first or @combine = 'choice' or @combine = 'interleave'"> + <xsl:copy> + <xsl:for-each select="@*"> + <xsl:copy-of select="."/> + </xsl:for-each> + <xsl:apply-templates mode="rng.mode"> + <xsl:with-param name="first" select="$first"/> + <xsl:with-param name="ns" select="$ns"/> + <xsl:with-param name="nss" select="$nss"/> + </xsl:apply-templates> + </xsl:copy> + </xsl:if> +</xsl:template> + <xsl:template mode="rng.mode" match="rng:anyName/rng:except"> + <xsl:param name="first"/> <xsl:param name="ns"/> <xsl:param name="nss"/> <except> |