/usr/share/photoml/xsl/defaults/debug.xsl is in photoml 0.28-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | <?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exslt="http://exslt.org/common"
xmlns:func="http://exslt.org/functions"
xmlns:debug="http://wohlberg.net/xml/debug"
extension-element-prefixes="exslt func"
version="1.0">
<!--
This file contains templates for constructing output for use in
debugging the defaults expansion code.
Copyright © 2005-2007 Brendt Wohlberg <photoml@wohlberg.net>
This is free software; you can redistribute it and/or modify it
under the terms of version 2 of the GNU General Public License
at http://www.gnu.org/licenses/gpl-2.0.txt.
This software 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 General Public License for more details.
-->
<!-- *****************************************************************
Extension function calling template with name debug-node-set.
***************************************************************** -->
<func:function name="debug:debug-node-set">
<xsl:param name="nodes" select="/.."/>
<xsl:param name="label" select="''"/>
<xsl:param name="txtdf" select="false()"/>
<xsl:param name="indnt" select="' '"/>
<xsl:variable name="result">
<xsl:call-template name="debug-node-set">
<xsl:with-param name="nodes" select="$nodes"/>
<xsl:with-param name="label" select="$label"/>
<xsl:with-param name="txtdf" select="$txtdf"/>
<xsl:with-param name="indnt" select="$indnt"/>
</xsl:call-template>
</xsl:variable>
<func:result select="$result"/>
</func:function>
<!-- *****************************************************************
Construct a representation of a node set for use in debugging.
The parameters are 'nodes', which is the node set for which the
debugging representation is desired, 'label', which is an initial
label string written before the node set representation, 'txtdf',
which is a flag indicating whether all text nodes should be
included or only text nodes which contain non-whitespace content,
and 'indnt', which is a string containing the number of spaces
for the initial indentation
Note: When using this template to display the content of a result
tree fragment converted into a node set by using exslt:node-set,
parameter "nodes" should have a value of "exslt:node-set($var)/*",
as opposed to "$var" when the variable is itself a node set.
***************************************************************** -->
<xsl:template name="debug-node-set">
<xsl:param name="nodes" select="/.."/>
<xsl:param name="label" select="''"/>
<xsl:param name="txtdf" select="false()"/>
<xsl:param name="indnt" select="' '"/>
<xsl:if test="$label != ''">
<xsl:value-of select="$label"/>
<xsl:value-of select="$indnt"/>
<xsl:text>[Node set contains </xsl:text>
<xsl:value-of select="count($nodes)"/>
<xsl:choose>
<xsl:when test="count($nodes) = 1">
<xsl:text> node</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text> nodes</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>, including </xsl:text>
<xsl:value-of select="count($nodes[self::*])"/>
<xsl:choose>
<xsl:when test="count($nodes[self::*]) = 1">
<xsl:text> element</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text> elements</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>] </xsl:text>
</xsl:if>
<xsl:apply-templates select="$nodes[self::*]|$nodes[self::text()]|
$nodes[self::comment()]|
$nodes[self::processing-instruction()]"
mode="debug-node-set-mode">
<xsl:with-param name="indnt" select="concat($indnt,' ')"/>
<xsl:with-param name="txtdf" select="$txtdf"/>
</xsl:apply-templates>
</xsl:template>
<!-- *****************************************************************
Construct the node set debugging representation of an element.
***************************************************************** -->
<xsl:template match="*" mode="debug-node-set-mode">
<xsl:param name="txtdf" select="false()"/>
<xsl:param name="indnt" select="' '"/>
<xsl:value-of select="$indnt"/>
<xsl:value-of select="name(.)"/>
<xsl:apply-templates select="@*" mode="debug-node-set-mode"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="*|text()|comment()|processing-instruction()"
mode="debug-node-set-mode">
<xsl:with-param name="indnt" select="concat($indnt,' ')"/>
<xsl:with-param name="txtdf" select="$txtdf"/>
</xsl:apply-templates>
</xsl:template>
<!-- *****************************************************************
Construct the node set debugging representation of an attribute.
***************************************************************** -->
<xsl:template match="@*" mode="debug-node-set-mode">
<xsl:param name="indnt" select="' '"/>
<xsl:text> [</xsl:text>
<xsl:value-of select="name(.)"/>
<xsl:text>=</xsl:text>
<xsl:value-of select="."/>
<xsl:text>]</xsl:text>
</xsl:template>
<!-- *****************************************************************
Construct the node set debugging representation of a text node.
***************************************************************** -->
<xsl:template match="text()" mode="debug-node-set-mode">
<xsl:param name="txtdf" select="false()"/>
<xsl:param name="indnt" select="' '"/>
<xsl:if test="boolean($txtdf) or translate(normalize-space(.),' ','')!=''">
<xsl:value-of select="$indnt"/>
<xsl:text>[text: </xsl:text>
<xsl:value-of select="translate(substring(.,1,20),' ',' ')"/>
<xsl:text>] </xsl:text>
</xsl:if>
</xsl:template>
<!-- *****************************************************************
Construct the node set debugging representation of a comment.
***************************************************************** -->
<xsl:template match="comment()" mode="debug-node-set-mode">
<xsl:param name="indnt" select="' '"/>
<xsl:value-of select="$indnt"/>
<xsl:text>[comment: </xsl:text>
<xsl:value-of select="translate(substring(.,1,20),' ',' ')"/>
<xsl:text>] </xsl:text>
</xsl:template>
<!-- *****************************************************************
Construct the node set debugging representation of a processing
instruction.
***************************************************************** -->
<xsl:template match="processing-instruction()" mode="debug-node-set-mode">
<xsl:param name="indnt" select="' '"/>
<xsl:value-of select="$indnt"/>
<xsl:text>[pi: </xsl:text>
<xsl:value-of select="name(.)"/>
<xsl:text> </xsl:text>
<xsl:value-of select="translate(substring(.,1,20),' ',' ')"/>
<xsl:text>] </xsl:text>
</xsl:template>
</xsl:stylesheet>
|