home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 June / maximum-cd-2011-06.iso / DiscContents / LibO_3.3.1_Win_x86_install_multi.exe / libreoffice1.cab / header.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2010-12-01  |  19.5 KB  |  485 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3.  
  4.   DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  5.   
  6.   Copyright 2000, 2010 Oracle and/or its affiliates.
  7.  
  8.   OpenOffice.org - a multi-platform office productivity suite
  9.  
  10.   This file is part of OpenOffice.org.
  11.  
  12.   OpenOffice.org is free software: you can redistribute it and/or modify
  13.   it under the terms of the GNU Lesser General Public License version 3
  14.   only, as published by the Free Software Foundation.
  15.  
  16.   OpenOffice.org is distributed in the hope that it will be useful,
  17.   but WITHOUT ANY WARRANTY; without even the implied warranty of
  18.   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19.   GNU Lesser General Public License version 3 for more details
  20.   (a copy is included in the LICENSE file that accompanied this code).
  21.  
  22.   You should have received a copy of the GNU Lesser General Public License
  23.   version 3 along with OpenOffice.org.  If not, see
  24.   <http://www.openoffice.org/license.html>
  25.   for a copy of the LGPLv3 License.
  26.  
  27. -->
  28. <!--
  29.     For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
  30. -->
  31. <xsl:stylesheet version="1.0"
  32.     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  33.     xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
  34.     xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
  35.     xmlns:dc="http://purl.org/dc/elements/1.1/"
  36.     xmlns:dom="http://www.w3.org/2001/xml-events"
  37.     xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
  38.     xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
  39.     xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
  40.     xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
  41.     xmlns:math="http://www.w3.org/1998/Math/MathML"
  42.     xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
  43.     xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
  44.     xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
  45.     xmlns:ooo="http://openoffice.org/2004/office"
  46.     xmlns:oooc="http://openoffice.org/2004/calc"
  47.     xmlns:ooow="http://openoffice.org/2004/writer"
  48.     xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
  49.     xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
  50.     xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
  51.     xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
  52.     xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
  53.     xmlns:xforms="http://www.w3.org/2002/xforms"
  54.     xmlns:xlink="http://www.w3.org/1999/xlink"
  55.     xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  56.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  57.     exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi xforms xsd xsi"
  58.     xmlns="http://www.w3.org/1999/xhtml">
  59.  
  60.  
  61.     <!-- ************** -->
  62.     <!-- *** header *** -->
  63.     <!-- ************** -->
  64.  
  65.     <xsl:template name="create-header">
  66.         <xsl:param name="globalData" />
  67.  
  68.         <xsl:element name="head">
  69.         <xsl:attribute name="profile">http://dublincore.org/documents/dcmi-terms/</xsl:attribute>
  70.             <xsl:if test="$debugEnabled"><xsl:message>CSS helper variable will be created....</xsl:message></xsl:if>
  71.             <xsl:call-template name='xhtml-header-properties'>
  72.                 <xsl:with-param name="globalData" select="$globalData" />
  73.             </xsl:call-template>
  74.  
  75.             <xsl:if test="$debugEnabled"><xsl:message>CSS variable ready, header will be created....</xsl:message></xsl:if>
  76.             <!-- constructing the css header simulating inheritance of style-families by style order -->
  77.             <xsl:call-template name='create-css-styleheader'>
  78.                 <xsl:with-param name="globalData" select="$globalData" />
  79.             </xsl:call-template>
  80.             <xsl:if test="$debugEnabled"><xsl:message>CSS header creation finished!</xsl:message></xsl:if>
  81.         </xsl:element>
  82.  
  83.     </xsl:template>
  84.  
  85.  
  86.     <!-- Creating a CSS style header from the collected styles of the 'globalData' parameter -->
  87.     <xsl:template name='create-css-styleheader'>
  88.         <xsl:param name="globalData" />
  89.  
  90.         <xsl:element name="style">
  91.             <xsl:attribute name="type">text/css</xsl:attribute>
  92. <xsl:text>
  93.     </xsl:text>
  94.     <xsl:call-template name='create-page-layout'>
  95.         <xsl:with-param name="globalData" select="$globalData" />
  96.     </xsl:call-template>
  97. <xsl:text>table { border-collapse:collapse; border-spacing:0; empty-cells:show }
  98.     </xsl:text>
  99.     <xsl:choose>
  100.         <xsl:when test="/*/office:body/office:spreadsheet"><xsl:text>td, th { vertical-align:top; font-size:10pt;}
  101.     </xsl:text></xsl:when>
  102.         <xsl:otherwise><xsl:text>td, th { vertical-align:top; font-size:12pt;}
  103.     </xsl:text></xsl:otherwise>
  104.     </xsl:choose>
  105. <xsl:text>h1, h2, h3, h4, h5, h6 { clear:both }
  106.     </xsl:text>
  107. <xsl:text>ol, ul { margin:0; padding:0;}
  108.     </xsl:text>
  109. <xsl:text>li { list-style: none; margin:0; padding:0;}
  110.     </xsl:text>
  111. <xsl:comment> "li span.odfLiEnd" - IE 7 issue</xsl:comment>
  112. <xsl:text>
  113.     </xsl:text>
  114. <xsl:text>li span. { clear: both; line-height:0; width:0; height:0; margin:0; padding:0; }
  115.     </xsl:text>
  116. <xsl:text>span.footnodeNumber { padding-right:1em; }
  117.     </xsl:text>
  118. <xsl:text>span.annotation_style_by_filter { font-size:95%; font-family:Arial; background-color:#fff000;  margin:0; border:0; padding:0;  }
  119.     </xsl:text>        
  120. <xsl:text>* { margin:0;}
  121.     </xsl:text>
  122.             <xsl:call-template name="write-mapped-CSS-styles">
  123.                 <xsl:with-param name="globalData" select="$globalData" />
  124.             </xsl:call-template>
  125.         </xsl:element>
  126.     </xsl:template>
  127.  
  128.     <xsl:template name="write-mapped-CSS-styles">
  129.         <xsl:param name="globalData" />
  130.         <xsl:param name="styleNo" select="1"/>
  131.         <xsl:param name="emptyStyles"/>
  132.  
  133.         <xsl:choose>
  134.             <xsl:when test="$globalData/all-styles/style[$styleNo]">
  135.             <!-- If there is still a style to be written -->
  136.                 <!-- setting the context -->
  137.                 <xsl:for-each select="$globalData/all-styles/style[$styleNo]">
  138.                 <xsl:choose>
  139.                     <xsl:when test="final-properties != ''">
  140.                     <!-- NOTE: easy process, as only the style family in conjunction with the style name, makes the style unambigous -->
  141.                 <xsl:text>.</xsl:text><!--<xsl:value-of select="@style:family" /><xsl:text>:</xsl:text>--><xsl:value-of select="translate(@style:name, '.,;: %()[]/\+', '_____________')"/><xsl:text> { </xsl:text> <xsl:value-of select="final-properties" /><xsl:text>}
  142.     </xsl:text>
  143.                         <xsl:call-template name="write-mapped-CSS-styles">
  144.                             <xsl:with-param name="globalData" select="$globalData" />
  145.                             <xsl:with-param name="emptyStyles" select="$emptyStyles"/>
  146.                             <xsl:with-param name="styleNo" select="$styleNo + 1"/>
  147.                         </xsl:call-template>
  148.                     </xsl:when>
  149.                     <xsl:otherwise>
  150.                         <xsl:call-template name="write-mapped-CSS-styles">
  151.                             <xsl:with-param name="globalData" select="$globalData" />
  152.                             <xsl:with-param name="emptyStyles" select="concat($emptyStyles, '.', @style:name, ' ')"/>
  153.                             <xsl:with-param name="styleNo" select="$styleNo + 1"/>
  154.                         </xsl:call-template>
  155.                     </xsl:otherwise>
  156.                 </xsl:choose>
  157.                 </xsl:for-each>
  158.             </xsl:when>
  159.             <xsl:otherwise>
  160.             <!-- Otherwise all styles have been processed and the empty styles have to be given out -->
  161.                 <xsl:comment> ODF styles with no properties representable as CSS </xsl:comment><xsl:text>
  162.     </xsl:text><xsl:value-of select="$emptyStyles"/><xsl:text>{ }
  163.     </xsl:text>
  164.             </xsl:otherwise>
  165.         </xsl:choose>
  166.     </xsl:template>
  167.  
  168.  
  169.     <!-- Creating CSS page layout based on first office master style -->
  170.     <xsl:template name='create-page-layout'>
  171.         <xsl:param name="globalData" />
  172.  
  173.         <!-- approximation to find the correct master page style (with page dimensions) -->
  174.         <xsl:variable name="masterPageNames">
  175.             <!-- set context to styles.xml -->
  176.             <xsl:for-each select="$globalData/all-doc-styles/style">
  177.                 <!-- Loop over every style:style containing a @style:master-page-name attribute -->            
  178.                 <xsl:for-each select="key('masterPage','count')">
  179.                         <!-- set context to styles.xml -->
  180.                         <xsl:for-each select="/*/office:body">
  181.                             <!-- Check if this style is being used in the body -->
  182.                             <xsl:if test="key('elementUsingStyle', ../@style:name)">
  183.                                 <!-- Check every master-page-name if it is not emtpy and return as ';' separated list  -->
  184.                                 <xsl:if test="string-length(../@style:master-page-name) > 0"><xsl:value-of select="../@style:master-page-name"/>;</xsl:if>
  185.                             </xsl:if>
  186.                         </xsl:for-each>
  187.                 </xsl:for-each>
  188.             </xsl:for-each>
  189.         </xsl:variable>
  190.         <!-- Take the first of the masterpage list and get the according style:master-page element and find the @style:page-layout-name  -->
  191.         <xsl:variable name="pageLayoutName" select="key('masterPageElements', substring-before($masterPageNames,';'))/@style:page-layout-name"/>
  192.          <!-- Find the according style:page-layout and store the properties in a variable  -->
  193.         <xsl:variable name="pageProperties" select="key('pageLayoutElements', $pageLayoutName)/style:page-layout-properties"/>
  194.  
  195. <xsl:text>@page { </xsl:text>
  196.  
  197.         <xsl:call-template name="page-size">
  198.             <xsl:with-param name="globalData"       select="$globalData" />
  199.             <xsl:with-param name="pageProperties"   select="$pageProperties" />
  200.         </xsl:call-template>
  201.         <xsl:call-template name="page-margin">
  202.             <xsl:with-param name="globalData"       select="$globalData" />
  203.             <xsl:with-param name="pageProperties"   select="$pageProperties" />
  204.         </xsl:call-template>
  205.  
  206. <xsl:text> }
  207.     </xsl:text>
  208.  
  209.     </xsl:template>
  210.  
  211.  
  212.     <xsl:template name="page-size">
  213.         <xsl:param name="globalData" />
  214.         <xsl:param name="pageProperties" />
  215.  
  216.         <xsl:variable name="printOrientation"  select="$pageProperties/@style:print-orientation" />
  217.         <xsl:variable name="pageWidth"         select="$pageProperties/@fo:page-width" />
  218.         <xsl:variable name="pageHeight"        select="$pageProperties/@fo:page-height" />
  219.         <xsl:choose>
  220.             <xsl:when test="$pageWidth and $pageHeight">
  221.                 <xsl:text>size: </xsl:text>
  222.                 <xsl:value-of select="$pageWidth" />
  223.                 <xsl:text> </xsl:text>
  224.                 <xsl:value-of select="$pageHeight" />
  225.                 <xsl:text>; </xsl:text>
  226.             </xsl:when>
  227.             <xsl:when test="$printOrientation">
  228.                 <xsl:text>size: </xsl:text>
  229.                 <xsl:value-of select="$printOrientation" />
  230.                 <xsl:text>; </xsl:text>
  231.             </xsl:when>
  232.         </xsl:choose>
  233.     </xsl:template>
  234.  
  235.  
  236.  
  237.     <xsl:template name="page-margin">
  238.         <xsl:param name="globalData" />
  239.         <xsl:param name="pageProperties" />
  240.  
  241.         <xsl:variable name="marginTop"  select="$pageProperties/@fo:margin-top" />
  242.         <xsl:if test="$marginTop">
  243.             <xsl:text>margin-top: </xsl:text>
  244.             <xsl:value-of select="$marginTop" />
  245.             <xsl:text>; </xsl:text>
  246.         </xsl:if>
  247.         <xsl:variable name="marginBottom"  select="$pageProperties/@fo:margin-bottom" />
  248.         <xsl:if test="$marginBottom">
  249.             <xsl:text>margin-bottom: </xsl:text>
  250.             <xsl:value-of select="$marginBottom" />
  251.             <xsl:text>; </xsl:text>
  252.         </xsl:if>
  253.         <xsl:variable name="marginLeft"  select="$pageProperties/@fo:margin-left" />
  254.         <xsl:if test="$marginLeft">
  255.             <xsl:text>margin-left: </xsl:text>
  256.             <xsl:value-of select="$marginLeft" />
  257.             <xsl:text>; </xsl:text>
  258.         </xsl:if>
  259.         <xsl:variable name="marginRight"  select="$pageProperties/@fo:margin-right" />
  260.         <xsl:if test="$marginRight">
  261.             <xsl:text>margin-right: </xsl:text>
  262.             <xsl:value-of select="$marginRight" />
  263.         </xsl:if>
  264.     </xsl:template>
  265.  
  266.  
  267.     <!-- *************************** -->
  268.     <!-- *** Common XHTML header *** -->
  269.     <!-- *************************** -->
  270.  
  271.     <xsl:template name='xhtml-header-properties'>
  272.         <xsl:param name="globalData" />
  273.  
  274.         <xsl:variable name="netloc">
  275.         <xsl:for-each select="$globalData/meta-file/*/office:meta/meta:user-defined">
  276.         <xsl:if test="./@meta:name='ODF.base'">
  277.         <xsl:value-of select="." />
  278.         </xsl:if>
  279.         </xsl:for-each>
  280.         <xsl:for-each select="$globalData/meta-file/*/office:meta/meta:user-defined">
  281.         <xsl:if test="./@meta:name='ODF.filename'">
  282.         <xsl:value-of select="." />
  283.         </xsl:if>
  284.         </xsl:for-each>
  285.         </xsl:variable>
  286.  
  287.         <xsl:variable name="lang">
  288.              <xsl:choose>
  289.                  <xsl:when test="$globalData/meta-file/*/office:meta/dc:language">
  290.                      <xsl:value-of select="$globalData/meta-file/*/office:meta/dc:language" />
  291.                  </xsl:when>
  292.                  <xsl:otherwise>en-US</xsl:otherwise>
  293.              </xsl:choose>
  294.         </xsl:variable>
  295.  
  296.         <xsl:variable name="prov">
  297.              <xsl:choose>
  298.                  <xsl:when test="$globalData/meta-file/*/office:meta/meta:printed-by">
  299.                      <xsl:value-of select="concat('Printed by "',$globalData/meta-file/*/office:meta/meta:printed-by,'"[dc:publisher] on "',$globalData/meta-file/*/office:meta/meta:print-date,'"[dc:date] in "',$lang,'"[dc:language]')" />
  300.                  </xsl:when>
  301.                  <xsl:otherwise />
  302.              </xsl:choose>
  303.         </xsl:variable>
  304.  
  305.         <xsl:variable name="keywords">
  306.             <xsl:for-each select="$globalData/meta-file/*/office:meta/meta:keyword">
  307.                 <xsl:value-of select="." />
  308.                     <xsl:if test="position() != last()">
  309.                         <xsl:text>, </xsl:text>
  310.                     </xsl:if>
  311.             </xsl:for-each>
  312.         </xsl:variable>
  313.  
  314.         <!-- explicit output content-type for low-tech browser (e.g. IE6) -->
  315.         <xsl:element name="meta">
  316.             <xsl:attribute name="http-equiv">Content-Type</xsl:attribute>
  317.             <xsl:attribute name="content">application/xhtml+xml; charset=utf-8</xsl:attribute>
  318.         </xsl:element>
  319.  
  320.         <!-- title of document for browser frame title -->
  321.         <xsl:element name="title">
  322.         <xsl:attribute name="lang" namespace="http://www.w3.org/XML/1998/namespace">
  323.             <xsl:value-of select="$lang" />
  324.         </xsl:attribute>
  325.  
  326.             <xsl:choose>
  327.                 <xsl:when test="$globalData/meta-file/*/office:meta/dc:title">
  328.                     <xsl:value-of select="$globalData/meta-file/*/office:meta/dc:title" />
  329.                 </xsl:when>
  330.                 <!-- providing the mandatory title is a workaround for an IE bug-->
  331.                 <xsl:otherwise>
  332.                     <xsl:text>- no title specified</xsl:text>
  333.                 </xsl:otherwise>
  334.             </xsl:choose>
  335.         </xsl:element>
  336.  
  337.         <!-- title, in DC syntax -->
  338.         <xsl:element name="meta">
  339.             <xsl:attribute name="name">DCTERMS.title</xsl:attribute>
  340.             <xsl:attribute name="content">
  341.                <xsl:value-of select="$globalData/meta-file/*/office:meta/dc:title" />
  342.             </xsl:attribute>
  343.             <xsl:attribute name="lang" namespace="http://www.w3.org/XML/1998/namespace">
  344.                <xsl:value-of select="$lang" />
  345.             </xsl:attribute>
  346.         </xsl:element>
  347.  
  348.         <!-- the identifier for source  (identifier) -->
  349.         <xsl:call-template name="add-meta-tag">
  350.             <xsl:with-param name="meta-name" select="'DCTERMS.identifier'" />
  351.             <xsl:with-param name="meta-data" select="translate($netloc, ' ','')" />
  352.             <xsl:with-param name="meta-enc" select="'DCTERMS.URI'" />
  353.         </xsl:call-template>
  354.  
  355.         <!-- the language for source  (language) -->
  356.         <xsl:call-template name="add-meta-tag">
  357.             <xsl:with-param name="meta-name" select="'DCTERMS.language'" />
  358.             <xsl:with-param name="meta-data" select="$lang" />
  359.             <xsl:with-param name="meta-enc" select="'DCTERMS.RFC4646'" />
  360.         </xsl:call-template>
  361.  
  362.         <!-- a bit commercial (generator) -->
  363.         <xsl:element name="meta">
  364.             <xsl:attribute name="name">DCTERMS.source</xsl:attribute>
  365.             <xsl:attribute name="content">http://xml.openoffice.org/odf2xhtml</xsl:attribute>
  366.         </xsl:element>
  367.  
  368.         <!-- the author of the input source (author) -->
  369.         <xsl:call-template name="add-meta-tag">
  370.             <xsl:with-param name="meta-name" select="'DCTERMS.creator'" />
  371.             <xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/meta:initial-creator" />
  372.         </xsl:call-template>
  373.  
  374.         <!-- creation-date of the input source (issued) -->
  375.         <xsl:call-template name="add-meta-tag">
  376.             <xsl:with-param name="meta-name" select="'DCTERMS.issued'" />
  377.             <xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/meta:creation-date" />
  378.             <xsl:with-param name="meta-enc" select="'DCTERMS.W3CDTF'" />
  379.         </xsl:call-template>
  380.  
  381.         <!-- name of last changing person of the input source (changedby) -->
  382.         <xsl:call-template name="add-meta-tag">
  383.             <xsl:with-param name="meta-name" select="'DCTERMS.contributor'" />
  384.             <xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/dc:creator" />
  385.         </xsl:call-template>
  386.  
  387.         <!-- last changing date of the input source (changed) -->
  388.         <xsl:call-template name="add-meta-tag">
  389.             <xsl:with-param name="meta-name" select="'DCTERMS.modified'" />
  390.             <xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/dc:date" />
  391.             <xsl:with-param name="meta-enc" select="'DCTERMS.W3CDTF'" />
  392.         </xsl:call-template>
  393.  
  394.         <!-- Last print, as provenance -->
  395.         <xsl:if test="$prov">
  396.         <xsl:call-template name="add-meta-tag">
  397.             <xsl:with-param name="meta-name" select="'DCTERMS.provenance'" />
  398.             <xsl:with-param name="meta-data" select="$prov" />
  399.             <xsl:with-param name="meta-lang" select="$lang" />
  400.         </xsl:call-template>
  401.         </xsl:if>
  402.  
  403.         <!-- keywords about the input source (keywords) -->
  404.         <xsl:call-template name="add-meta-tag">
  405.             <xsl:with-param name="meta-name" select="'DCTERMS.subject'" />
  406.             <xsl:with-param name="meta-data" select="normalize-space(concat($globalData/meta-file/*/office:meta/dc:subject,',   ',$keywords))" />
  407.             <xsl:with-param name="meta-lang" select="$lang" />
  408.         </xsl:call-template>
  409.  
  410.         <!-- detailed description about the input source (description) -->
  411.         <xsl:call-template name="add-meta-tag">
  412.             <xsl:with-param name="meta-name" select="'DCTERMS.description'" />
  413.             <xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/dc:description" />
  414.             <xsl:with-param name="meta-lang" select="$lang" />
  415.         </xsl:call-template>
  416.  
  417.  
  418.         <!-- user defined use of DCTERM tags -->
  419.         <xsl:for-each select="$globalData/meta-file/*/office:meta/meta:user-defined[starts-with(@meta:name,'DCTERMS.')][not(.='')]">
  420.         <xsl:call-template name="add-meta-tag">
  421.             <xsl:with-param name="meta-name" select="@meta:name" />
  422.             <xsl:with-param name="meta-data" select="." />
  423.             <!-- <xsl:with-param name="meta-lang" select="$lang" /> -->
  424.         </xsl:call-template>
  425.         </xsl:for-each>
  426.         <!-- user defined use of DC tags (legacy) -->
  427.         <xsl:for-each select="$globalData/meta-file/*/office:meta/meta:user-defined[starts-with(@meta:name,'DC.')][not(.='')]">
  428.         <xsl:call-template name="add-meta-tag">
  429.             <xsl:with-param name="meta-name" select="@meta:name" />
  430.             <xsl:with-param name="meta-data" select="." />
  431.             <!-- <xsl:with-param name="meta-lang" select="$lang" /> -->
  432.         </xsl:call-template>
  433.         </xsl:for-each>
  434.  
  435.         <link rel="schema.DC" href="http://purl.org/dc/elements/1.1/" hreflang="en" />
  436.         <link rel="schema.DCTERMS" href="http://purl.org/dc/terms/" hreflang="en" />
  437.         <link rel="schema.DCTYPE" href="http://purl.org/dc/dcmitype/" hreflang="en" />
  438.         <link rel="schema.DCAM" href="http://purl.org/dc/dcam/" hreflang="en" />
  439.         <!-- W3C GRDDL Profile -->
  440.         <!--
  441.         <link rel="transformation" href="http://xml.openoffice.org/odf2xhtml/rdf-extract.xsl" />
  442.         -->
  443.  
  444.         <!-- base URL of document for resolving relative links  -->
  445.         <xsl:element name="base">
  446.             <xsl:attribute name="href">
  447.                 <!-- earlier 'targetURL' was used for an absoulte reference of base provided by the Office (file URL)
  448.                     <xsl:value-of select="$targetURL" />
  449.                     now '.' let relative links work, even if document has been moved -->
  450.                 <xsl:text>.</xsl:text>
  451.             </xsl:attribute>
  452.         </xsl:element>
  453.     </xsl:template>
  454.  
  455.     <!-- generic template for adding common meta tags -->
  456.     <xsl:template name="add-meta-tag">
  457.         <xsl:param name="meta-name" />
  458.         <xsl:param name="meta-data" />
  459.         <xsl:param name="meta-enc" />
  460.         <xsl:param name="meta-lang" />
  461.  
  462.         <xsl:if test="$meta-data">
  463.             <xsl:element name="meta">
  464.                 <xsl:attribute name="name">
  465.                     <xsl:value-of select="$meta-name" />
  466.                 </xsl:attribute>
  467.                 <xsl:attribute name="content">
  468.                     <xsl:value-of select="$meta-data" />
  469.                 </xsl:attribute>
  470.                 <xsl:if test="$meta-enc">
  471.                 <xsl:attribute name="scheme">
  472.                     <xsl:value-of select="$meta-enc" />
  473.                 </xsl:attribute>
  474.                 </xsl:if>
  475.                 <xsl:if test="$meta-lang">
  476.                 <xsl:attribute name="lang" namespace="http://www.w3.org/XML/1998/namespace">
  477.                     <xsl:value-of select="$meta-lang" />
  478.                 </xsl:attribute>
  479.                 </xsl:if>
  480.             </xsl:element>
  481.         </xsl:if>
  482.     </xsl:template>
  483.  
  484. </xsl:stylesheet>
  485.