Apache-AxKit-Provider-OpenOffice

 view release on metacpan or  search on metacpan

stylesheets/oo2html.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.org/2000/table" 
     xmlns:draw="http://openoffice.org/2000/drawing" 
     xmlns:fo="http://www.w3.org/1999/XSL/Format" 
     xmlns:xlink="http://www.w3.org/1999/xlink" 
     xmlns:number="http://openoffice.org/2000/datastyle" 
     xmlns:svg="http://www.w3.org/2000/svg" xmlns:chart="http://openoffice.org/2000/chart" xmlns:dr3d="http://openoffice.org/2000/dr3d" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="http://openoffice.org/2000/form" xmlns:script="http://...
<xsl:import href="oocommon.xsl"/>
<xsl:output method="html" indent="yes" encoding="ISO-8859-1"/>

<!-- User-editable configuration -->

<xsl:variable name="css-file">screen.css</xsl:variable>
<!--<xsl:variable name="css-file"/>-->
<!-- end user configuration -->

<!-- root template -->
<xsl:template match="/">
<html>
  <xsl:call-template name="meta-header"/>
  <xsl:apply-templates select="office:document-content/office:body"/>
</html>
</xsl:template>
<!-- end root template -->

<!-- css -->
<xsl:template name="css-styles">
  <style type="text/css">
    <xsl:comment>
div.toc {   
        color: blue;
        background-color:#eeeeee;
        border-color: #333300;
        border-width: 2px 2px 2px 2px;
        border-style: solid;
        margin: 1px 0px 1px 0px;  
        padding: 2px 0px 3px 5px;
}

    <xsl:apply-templates select="/office:document-content/office:automatic-styles"/>
    <xsl:apply-templates select="$styles"/>
    </xsl:comment>
  </style>
</xsl:template>

<xsl:template match="style:default-style[@style:family='paragraph']">
p {
  <xsl:variable name="current-font" select="style:properties/@style:font-name"/>
  <xsl:variable name="mapped-font" select="//office:font-decls/style:font-decl[@style:name=$current-font]"/>
  font-family: <xsl:call-template name="css-font-helper"><xsl:with-param name="font-name" select="$mapped-font/@fo:font-family"/></xsl:call-template>;
  <!-- <xsl:if test="$mapped-font/@style:font-family-generic">,<xsl:value-of select="$mapped-font/@style:font-family-generic"/></xsl:if>; -->
  <xsl:for-each select="style:properties">
    <xsl:for-each select="@fo:font-size|@fo:color">
    <xsl:value-of select="local-name()"/>: <xsl:value-of select="."/>;
    </xsl:for-each>
  </xsl:for-each>
<xsl:text>
}
</xsl:text>

</xsl:template>

<xsl:template match="style:style">
<xsl:variable name="style-name">
 <xsl:call-template name="tokenize">
   <xsl:with-param name="string" select="@style:name"/>
 </xsl:call-template>
</xsl:variable>

<xsl:choose>
  <xsl:when test="@style:family='paragraph'">
    <xsl:choose>
      <xsl:when test="$style-name='Heading'">
        h1, h2, h3, h4, h5 {
      </xsl:when>
      <xsl:when test="contains($style-name, 'Heading')">
        .<xsl:value-of select="$style-name"/> {
      </xsl:when>      
      <xsl:otherwise>
        p.<xsl:value-of select="$style-name"/> {
      </xsl:otherwise>
    </xsl:choose>
  </xsl:when>
  <xsl:when test="@style:family='text'">
    span.<xsl:value-of select="$style-name"/> {
  </xsl:when>
  <xsl:otherwise>
  .<xsl:value-of select="$style-name"/> {
  </xsl:otherwise>
</xsl:choose>

  <xsl:for-each select="style:properties">



( run in 1.266 second using v1.01-cache-2.11-cpan-f56aa216473 )