Tryag File Manager
Home
-
Turbo Force
Current Path :
/
home
/
cluster1
/
data
/
bu01
/
1121861
/
html
/
maxwell-old-archive
/
litprog-1.0
/
Upload File :
New :
File
Dir
/home/cluster1/data/bu01/1121861/html/maxwell-old-archive/litprog-1.0/weave.xsl
<?xml version="1.0" encoding="utf-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:src="http://nwalsh.com/xmlns/litprog/fragment" exclude-result-prefixes="xsl src xml" version="1.0"> <xsl:include href="VERSION"/> <xsl:preserve-space elements="*"/> <xsl:output method="xml"/> <xsl:param name="mundane-result-prefixes" select="key('fragment',$top)/@mundane-result-prefixes"/> <xsl:key name="fragment" match="src:fragment" use="@id"/> <xsl:param name="top" select="'top'"/> <xsl:template match="/"> <xsl:text> </xsl:text> <xsl:comment> <xsl:text> This file was generated by weave.xsl version </xsl:text> <xsl:value-of select="$VERSION"/> <xsl:text>. Do not edit! </xsl:text> </xsl:comment> <xsl:text> </xsl:text> <xsl:comment> See http://sourceforge.net/projects/docbook/ </xsl:comment> <xsl:apply-templates/> </xsl:template> <xsl:template match="*"> <xsl:variable name="node" select="."/> <xsl:element name="{name(.)}" namespace="{namespace-uri(.)}"> <xsl:for-each select="namespace::*"> <xsl:if test="string(.) != namespace-uri($node)"> <xsl:copy/> </xsl:if> </xsl:for-each> <xsl:copy-of select="@*"/> <xsl:apply-templates/> </xsl:element> </xsl:template> <xsl:template match="processing-instruction()"> <xsl:processing-instruction name="{name(.)}"> <xsl:value-of select="."/> </xsl:processing-instruction> </xsl:template> <xsl:template match="comment()"> <xsl:comment> <xsl:value-of select="."/> </xsl:comment> </xsl:template> <xsl:template match="src:fragment"> <src:fragment id="{@id}"> <xsl:call-template name="copy-content"/> </src:fragment> </xsl:template> <xsl:template name="copy-content"> <xsl:variable name="first-node" select="node()[1]"/> <xsl:variable name="middle-nodes" select="node()[position() > 1 and position() < last()]"/> <xsl:variable name="last-node" select="node()[position() > 1 and position() = last()]"/> <xsl:choose> <xsl:when test="$first-node = text() and count(node()) = 1"> <xsl:variable name="leading-nl" select="substring($first-node, 1, 1) = '
'"/> <xsl:variable name="trailing-nl" select="substring($first-node, string-length($first-node), 1) = '
'"/> <xsl:choose> <xsl:when test="$leading-nl and $trailing-nl"> <xsl:value-of select="substring($first-node, 2, string-length($first-node)-2)"/> </xsl:when> <xsl:when test="$leading-nl"> <xsl:value-of select="substring($first-node, 2)"/> </xsl:when> <xsl:when test="$trailing-nl"> <xsl:value-of select="substring($first-node, 1, string-length($first-node)-1)"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="$first-node"/> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:when test="$first-node = text() and substring($first-node, 1, 1) = '
'"> <xsl:value-of select="substring($first-node, 2)"/> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="$first-node" mode="copy"/> </xsl:otherwise> </xsl:choose> <xsl:apply-templates select="$middle-nodes" mode="copy"/> <xsl:choose> <xsl:when test="$last-node = text() and substring($last-node, string-length($last-node), 1) = '
'"> <xsl:value-of select="substring($last-node, 1, string-length($last-node)-1)"/> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="$last-node" mode="copy"/> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="src:passthrough" mode="copy" priority="3"> <xsl:apply-templates select="node()|@*" mode="copy"/> </xsl:template> <xsl:template match="src:fragref" mode="copy" priority="3"> <xsl:choose> <xsl:when test="@disable-output-escaping='yes'"> <xsl:text><src:fragref linkend="</xsl:text> <xsl:value-of select="@linkend"/> <xsl:text>"/></xsl:text> <xsl:apply-templates mode="copy"/> <xsl:text></src:fragref></xsl:text> </xsl:when> <xsl:otherwise> <src:fragref linkend="{@linkend}"/> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="processing-instruction()" mode="copy" priority="2"> <xsl:text><?</xsl:text> <xsl:value-of select="name(.)"/> <xsl:value-of select="."/> <xsl:text>?></xsl:text> </xsl:template> <xsl:template match="comment()" mode="copy" priority="2"> <xsl:text><!--</xsl:text> <xsl:value-of select="."/> <xsl:text>--></xsl:text> </xsl:template> <xsl:template match="*" mode="copy" priority="2"> <xsl:variable name="exclude"> <xsl:choose> <xsl:when test="ancestor::src:fragment/@mundane-result-prefixes"> <xsl:value-of select="concat(' xml ', ancestor::src:fragment/@exclude-result-prefixes, ' ')"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="concat(' xml ', $mundane-result-prefixes, ' ')"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="applicable.namespaces"> <xsl:call-template name="count.applicable.namespaces"> <xsl:with-param name="namespaces" select="namespace::*"/> <xsl:with-param name="exclude-prefixes" select="$exclude"/> <xsl:with-param name="exclude-uri" select="'http://nwalsh.com/xmlns/litprog/fragment'"/> </xsl:call-template> </xsl:variable> <xsl:text><</xsl:text> <xsl:value-of select="name(.)"/> <xsl:if test="$applicable.namespaces > 0"> <xsl:call-template name="output.applicable.namespaces"> <xsl:with-param name="namespaces" select="namespace::*"/> <xsl:with-param name="exclude-prefixes" select="$exclude"/> <xsl:with-param name="exclude-uri" select="'http://nwalsh.com/xmlns/litprog/fragment'"/> </xsl:call-template> </xsl:if> <xsl:choose> <xsl:when test="$applicable.namespaces > 0"> <xsl:call-template name="output.applicable.attributes"> <xsl:with-param name="attributes" select="attribute::*"/> <xsl:with-param name="first" select="'0'"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:call-template name="output.applicable.attributes"> <xsl:with-param name="attributes" select="attribute::*"/> </xsl:call-template> </xsl:otherwise> </xsl:choose> <xsl:choose> <xsl:when test="node()"> <xsl:text>></xsl:text> <xsl:apply-templates select="node()" mode="copy"/> <xsl:text></</xsl:text> <xsl:value-of select="name(.)"/> <xsl:text>></xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>/></xsl:text> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="node()|@*" mode="copy"> <xsl:copy> <xsl:apply-templates select="@*|node()" mode="copy"/> </xsl:copy> </xsl:template> <xsl:template name="count.applicable.namespaces"> <xsl:param name="namespaces" select="namespace::*"/> <xsl:param name="exclude-prefixes" select="''"/> <xsl:param name="exclude-uri" select="'http://nwalsh.com/xmlns/litprog/fragment'"/> <xsl:param name="count" select="'0'"/> <xsl:variable name="on-ancestor"> <xsl:call-template name="matching.namespace"> <xsl:with-param name="context" select=".."/> <xsl:with-param name="prefix" select="name($namespaces[1])"/> <xsl:with-param name="uri" select="$namespaces[1]"/> </xsl:call-template> </xsl:variable> <xsl:choose> <xsl:when test="count($namespaces) = 0"> <xsl:value-of select="$count"/> </xsl:when> <xsl:when test="$on-ancestor != 0 or $namespaces[1] = $exclude-uri or (contains($exclude-prefixes, name($namespaces[1])) and name($namespaces[1]) != '')"> <!-- this one doesn't count --> <xsl:call-template name="count.applicable.namespaces"> <xsl:with-param name="namespaces" select="$namespaces[position()>1]"/> <xsl:with-param name="exclude-prefixes" select="$exclude-prefixes"/> <xsl:with-param name="exclude-uri" select="$exclude-uri"/> <xsl:with-param name="count" select="$count"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:call-template name="count.applicable.namespaces"> <xsl:with-param name="namespaces" select="$namespaces[position()>1]"/> <xsl:with-param name="exclude-prefixes" select="$exclude-prefixes"/> <xsl:with-param name="exclude-uri" select="$exclude-uri"/> <xsl:with-param name="count" select="$count + 1"/> </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="matching.namespace"> <xsl:param name="context" select="."/> <xsl:param name="prefix" select="''"/> <xsl:param name="uri" select="''"/> <xsl:variable name="c-match"> <xsl:choose> <xsl:when test="$context/self::src:fragment"> <xsl:text>0</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>0</xsl:text> <xsl:for-each select="$context/namespace::*"> <xsl:if test="name(.) = $prefix and string(.) = $uri">1</xsl:if> </xsl:for-each> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="match"> <xsl:choose> <xsl:when test="number($c-match) = 0 and $context/parent::* and not($context/parent::src:fragment) and not($context/self::src:fragment)"> <xsl:call-template name="matching.namespace"> <xsl:with-param name="context" select="$context/parent::*"/> <xsl:with-param name="prefix" select="$prefix"/> <xsl:with-param name="uri" select="$uri"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$c-match"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:value-of select="number($match)"/> </xsl:template> <xsl:template name="output.applicable.namespaces"> <xsl:param name="namespaces" select="namespace::*"/> <xsl:param name="exclude-prefixes" select="''"/> <xsl:param name="exclude-uri" select="'http://nwalsh.com/xmlns/litprog/fragment'"/> <xsl:param name="first" select="'1'"/> <xsl:variable name="on-ancestor"> <xsl:call-template name="matching.namespace"> <xsl:with-param name="context" select=".."/> <xsl:with-param name="prefix" select="name($namespaces[1])"/> <xsl:with-param name="uri" select="$namespaces[1]"/> </xsl:call-template> </xsl:variable> <xsl:choose> <xsl:when test="count($namespaces) = 0"> <!-- do nothing --> </xsl:when> <xsl:when test="$on-ancestor != 0 or $namespaces[1] = $exclude-uri or (contains($exclude-prefixes, name($namespaces[1])) and name($namespaces[1]) != '')"> <!-- this one doesn't count --> <xsl:call-template name="output.applicable.namespaces"> <xsl:with-param name="namespaces" select="$namespaces[position()>1]"/> <xsl:with-param name="exclude-prefixes" select="$exclude-prefixes"/> <xsl:with-param name="exclude-uri" select="$exclude-uri"/> <xsl:with-param name="count" select="$first"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:choose> <xsl:when test="$first = 0"> <xsl:text> </xsl:text> <xsl:call-template name="indent"/> </xsl:when> <xsl:otherwise> <xsl:text> </xsl:text> </xsl:otherwise> </xsl:choose> <xsl:text>xmlns</xsl:text> <xsl:if test="name($namespaces[1]) != ''">:</xsl:if> <xsl:value-of select="name($namespaces[1])"/> <xsl:text>="</xsl:text> <xsl:value-of select="$namespaces[1]"/> <xsl:text>"</xsl:text> <xsl:call-template name="output.applicable.namespaces"> <xsl:with-param name="namespaces" select="$namespaces[position()>1]"/> <xsl:with-param name="exclude-prefixes" select="$exclude-prefixes"/> <xsl:with-param name="exclude-uri" select="$exclude-uri"/> <xsl:with-param name="first" select="0"/> </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="output.applicable.attributes"> <xsl:param name="attributes" select="attribute::*"/> <xsl:param name="first" select="'1'"/> <xsl:choose> <xsl:when test="count($attributes) = 0"> <!-- do nothing --> </xsl:when> <xsl:otherwise> <xsl:choose> <xsl:when test="$first = 0"> <xsl:text> </xsl:text> <xsl:call-template name="indent"/> </xsl:when> <xsl:otherwise> <xsl:text> </xsl:text> </xsl:otherwise> </xsl:choose> <xsl:value-of select="name($attributes[1])"/> <xsl:text>="</xsl:text> <xsl:value-of select="$attributes[1]"/> <xsl:text>"</xsl:text> <xsl:call-template name="output.applicable.attributes"> <xsl:with-param name="attributes" select="$attributes[position()>1]"/> <xsl:with-param name="first" select="'0'"/> </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="indent"> <xsl:param name="name" select="name(.)"/> <xsl:variable name="indent-spaces"> <xsl:call-template name="trailing-space-chars"> <xsl:with-param name="string" select="preceding-sibling::text()"/> </xsl:call-template> </xsl:variable> <!-- +2 for the leading < and the space after the name --> <xsl:variable name="indentlen" select="string-length($name) + $indent-spaces + 2"/> <xsl:call-template name="spaces"> <xsl:with-param name="count" select="$indentlen"/> </xsl:call-template> </xsl:template> <xsl:template name="spaces"> <xsl:param name="count" select="'0'"/> <xsl:if test="$count > 0"> <xsl:text> </xsl:text> <xsl:call-template name="spaces"> <xsl:with-param name="count" select="$count - 1"/> </xsl:call-template> </xsl:if> </xsl:template> <xsl:template name="trailing-space-chars"> <xsl:param name="string" select="''"/> <xsl:param name="count" select="0"/> <xsl:choose> <xsl:when test="$string = '' or substring($string,string-length($string),1) != ' '"> <xsl:value-of select="$count"/> </xsl:when> <xsl:otherwise> <xsl:call-template name="trailing-space-chars"> <xsl:with-param name="string" select="substring($string,1,string-length($string)-1)"/> <xsl:with-param name="count" select="$count + 1"/> </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet>