Stylesheet
verbatim.xsl
Documentation
Description
TEI stylesheet dealing with elements from the core module.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version. This library is
distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details. You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author: See AUTHORS
Id: $Id: verbatim.xsl 9329 2011-09-20 09:47:43Z rahtz $
Copyright: 2011, TEI Consortium
Imported from
Stylesheet version
2.0
Template
verbatim-getNamespacePrefix
Template
verbatim-newLine
Template
verbatim-lineBreak
Template
comment() verbatim
Documentation
Namespace
No namespace
Match
comment()
Mode
verbatim
References
Import precedence
3
Source
Stylesheet location
../common2/verbatim.xsl
Template
text() verbatim
Documentation
Description
Process text nodes in verbatim mode
[common]
Namespace
No namespace
Match
text()
Mode
verbatim
References
Import precedence
3
Source
<xsl:template match= "text()" mode= "verbatim" >
<xsl:choose >
<xsl:when test= "$forceWrap='true'" >
<xsl:variable name= "indent" >
<xsl:for-each select= "parent::*" >
<xsl:call-template name= "verbatim-makeIndent" />
</xsl:for-each>
</xsl:variable>
<xsl:if test= "string-length(.)>$wrapLength or parent::sch:assert" >
<xsl:text >
</xsl:text>
<xsl:value-of select= "$indent" />
</xsl:if>
<xsl:call-template name= "verbatim-reformatText" >
<xsl:with-param name= "sofar" > 0 </xsl:with-param>
<xsl:with-param name= "indent" >
<xsl:value-of select= "$indent" />
</xsl:with-param>
<xsl:with-param name= "text" >
<xsl:value-of select= "normalize-space(.)" />
</xsl:with-param>
</xsl:call-template>
<xsl:if test= "string-length(.)>$wrapLength or parent::sch:assert" >
<xsl:text >
</xsl:text>
<xsl:value-of select= "$indent" />
</xsl:if>
</xsl:when>
<xsl:when test= "not(preceding-sibling::node() or contains(.,'
'))" >
<xsl:if test= "starts-with(.,' ')" >
<xsl:text > </xsl:text>
</xsl:if>
<xsl:call-template name= "verbatim-Text" >
<xsl:with-param name= "words" >
<xsl:value-of select= "normalize-space(.)" />
</xsl:with-param>
</xsl:call-template>
<xsl:if test= "substring(.,string-length(.),1)=' '" >
<xsl:text > </xsl:text>
</xsl:if>
</xsl:when>
<xsl:when test= "normalize-space(.)=''" >
<xsl:for-each select= "following-sibling::*[1]" >
<xsl:call-template name= "verbatim-lineBreak" >
<xsl:with-param name= "id" > 7 </xsl:with-param>
</xsl:call-template>
<xsl:call-template name= "verbatim-makeIndent" />
</xsl:for-each>
</xsl:when>
<xsl:otherwise >
<xsl:call-template name= "verbatim-wraptext" >
<xsl:with-param name= "count" > 0 </xsl:with-param>
<xsl:with-param name= "indent" >
<xsl:for-each select= "parent::*" >
<xsl:call-template name= "verbatim-makeIndent" />
</xsl:for-each>
</xsl:with-param>
<xsl:with-param name= "text" >
<xsl:choose >
<xsl:when test= "starts-with(.,'
') and not (preceding-sibling::node())" >
<xsl:value-of select= "translate(substring(.,2),'
','⌤')" />
</xsl:when>
<xsl:otherwise >
<xsl:value-of select= "translate(.,'
','⌤')" />
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
<!--
<xsl:if test="substring(.,string-length(.))=' '">
<xsl:text> </xsl:text>
</xsl:if>
-->
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Stylesheet location
../common2/verbatim.xsl
Template
verbatim-reformatText
Template
verbatim-wraptext
Namespace
No namespace
Used by
References
Parameters
QName
Namespace
count
No namespace
indent
No namespace
text
No namespace
Import precedence
3
Source
<xsl:template name= "verbatim-wraptext" >
<xsl:param name= "indent" />
<xsl:param name= "text" />
<xsl:param name= "count" > 0 </xsl:param>
<xsl:variable name= "finalSpace" >
<xsl:choose >
<xsl:when test= "substring($text,string-length($text),1)=' '" >
<xsl:text > </xsl:text>
</xsl:when>
<xsl:when test= "substring($text,string-length($text),1)='⌤'" >
<xsl:text > </xsl:text>
</xsl:when>
<xsl:otherwise >
<xsl:text />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!--
<xsl:message>my text is [<xsl:value-of select="$text"/>]</xsl:message>
<xsl:message>my space is [<xsl:value-of select="$finalSpace"/>]</xsl:message>
-->
<xsl:choose >
<xsl:when test= "normalize-space($text)=''" />
<xsl:when test= "contains($text,'⌤')" >
<xsl:if test= "$count > 0" >
<xsl:value-of select= "$indent" />
<xsl:text > </xsl:text>
</xsl:if>
<xsl:if test= "starts-with($text,' ')" >
<xsl:text > </xsl:text>
</xsl:if>
<xsl:call-template name= "verbatim-Text" >
<xsl:with-param name= "words" >
<xsl:value-of select= "normalize-space(substring-before($text,'⌤'))" />
</xsl:with-param>
</xsl:call-template>
<!-- <xsl:if test="not(substring-after($text,' ')='')">-->
<xsl:call-template name= "verbatim-lineBreak" >
<xsl:with-param name= "id" > 6 </xsl:with-param>
</xsl:call-template>
<xsl:value-of select= "$indent" />
<xsl:call-template name= "verbatim-wraptext" >
<xsl:with-param name= "indent" >
<xsl:value-of select= "$indent" />
</xsl:with-param>
<xsl:with-param name= "text" >
<xsl:value-of select= "normalize-space(substring-after($text,'⌤'))" />
<xsl:value-of select= "$finalSpace" />
</xsl:with-param>
<xsl:with-param name= "count" >
<xsl:value-of select= "$count + 1" />
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise >
<xsl:if test= "starts-with($text,' ')" >
<xsl:text > </xsl:text>
</xsl:if>
<xsl:if test= "$count > 0 and parent::*" >
<xsl:value-of select= "$indent" />
<xsl:text > </xsl:text>
</xsl:if>
<xsl:call-template name= "verbatim-Text" >
<xsl:with-param name= "words" >
<xsl:value-of select= "normalize-space($text)" />
<xsl:value-of select= "$finalSpace" />
</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Stylesheet location
../common2/verbatim.xsl
Template
verbatim-Text
Template
* verbatim
Template
verbatim-createElement
Template
verbatim-createAttribute
Template
verbatim-makeElementName
Template
verbatim-makeIndent
Template
verbatim-makeSpace
Template
@* verbatim
Template
@* attributetext
Template
text()|comment()|processing-instruction() ns
Namespace
No namespace
Match
text()|comment()|processing-instruction()
Mode
ns
Import precedence
3
Source
Stylesheet location
../common2/verbatim.xsl
Template
* ns
Template
nsList
Parameter
useNSPrefixes
Parameter
startComment
Parameter
endComment
Parameter
startElement
Parameter
endElement
Parameter
startElementName
Parameter
endElementName
Parameter
highlightStartElementName
Parameter
highlightEndElementName
Parameter
startAttribute
Parameter
endAttribute
Parameter
startAttributeValue
Parameter
endAttributeValue
Parameter
startNamespace
Parameter
endNamespace
Parameter
spaceCharacter
Parameter
showNamespaceDecls
Parameter
forceWrap
Parameter
wrapLength
Parameter
attLength
Parameter
attsOnSameLine
Parameter
omitNSDecls
Function
tei:getPrefix
Key
NSUsed