Apache-AxKit-Provider-OpenOffice

 view release on metacpan or  search on metacpan

stylesheets/oocommon.xsl  view on Meta::CPAN

<?xml version="1.0" encoding="ISO-8859-1"?> 

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:office="http://openoffice.org/2000/office" xmlns:style="http://openoffice.org/2000/style" xmlns:text="http://openoffice.org/2000/text" xmlns:table="http://openoffice...

<!-- global params -->
<xsl:param name="oo.request.uri"/> 
<xsl:param name="oo.sxwfile"/> 
 
<!-- convenience variables -->
<xsl:variable 
     name="meta" 
     select="document( concat( $oo.sxwfile, '/meta.xml'), /)/office:document-meta/office:meta"
 />

<xsl:variable 
     name="styles" 
     select="document( concat( $oo.sxwfile, '/styles.xml'), /)/office:document-styles/office:styles"
 />
 
<xsl:variable name="document-title">
  <xsl:choose>
    <xsl:when test="$meta/dc:title">
      <xsl:value-of select="$meta/dc:title"/>
    </xsl:when>
    <xsl:when test="/office:document/office:body/text:p[@text:style-name='Title']">
      <xsl:value-of select="/office:document/office:body/text:p[@text:style-name='Title'][1]"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:text>Untitled Document</xsl:text>
    </xsl:otherwise>
  </xsl:choose>
</xsl:variable>
<!-- end 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">&#032;</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">



( run in 3.363 seconds using v1.01-cache-2.11-cpan-99c4e6809bf )