Stylesheet
verbatim.xsl
Documentation
Description
TEI stylesheet dealing with elements from the core module.
This software is dual-licensed:
1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
Unported License http://creativecommons.org/licenses/by-sa/3.0/
2. http://www.opensource.org/licenses/BSD-2-Clause
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.
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
holder 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.
Author: See AUTHORS
Id: $Id: verbatim.xsl 9646 2011-11-05 23:39:08Z 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 (ns, here )
Key
NSUsed