AxKit-App-TABOO
view release on metacpan or search on metacpan
htdocs/transforms/articles/xhtml/oocommon.xsl view on Meta::CPAN
<!-- convenience variables -->
<!-- begin functional templates -->
<xsl:template name="indent">
<xsl:param name="count">0</xsl:param>
<xsl:if test="$count > 0">
<xsl:text disable-output-escaping="yes"> </xsl:text>
<xsl:call-template name="indent">
<xsl:with-param name="count" select="$count -1"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!--
generic "commify" function.
accepts a flat nodelist and an optional string and
returns the text from the nodes in the nodeset seperated by commas and whitespace
-->
<xsl:template name="commify">
<xsl:param name="nodeset"/>
<xsl:param name="string"></xsl:param>
<xsl:choose>
<xsl:when test="$nodeset">
<xsl:call-template name="commify">
<xsl:with-param name="nodeset"
select="$nodeset[position() != 1]"/>
<xsl:with-param name="string">
<xsl:choose>
<xsl:when test="string-length( $string) > 0">
<xsl:value-of select="concat($string, ', ', $nodeset[position()=1]/text())"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$nodeset[position()=1]/text()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$string"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="tokenize">
<xsl:param name="string"/>
<xsl:value-of select="translate(normalize-space($string), ' ', '-')"/>
</xsl:template>
<!-- convert centimeters to pixels (badly) -->
<xsl:template name="cm2px">
<xsl:param name="string"/>
<xsl:choose>
<xsl:when test="contains($string, 'cm')">
<xsl:variable name="c" select="substring-before($string, 'cm')"/>
<xsl:choose>
<xsl:when test="string(number($c))='NaN'">
<xsl:value-of select="$string"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat( string( ceiling( number($c) div 2.55 * 72)) , 'px')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$string"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- end functional templates -->
</xsl:stylesheet>
( run in 0.507 second using v1.01-cache-2.11-cpan-140bd7fdf52 )