[Castore-commits] canonizeStyles-step3.xslt 1.2.2.1 1.2.2.2

Stéphane Bouchet sbouchet at adullact1.hosting.cri74.org
Lun 6 Mar 11:03:18 CET 2006


Update of /cvsroot/castore/castore-core/src/data/retro/canonize
In directory adullact1:/tmp/cvs-serv27902/src/data/retro/canonize

Modified Files:
      Tag: v1_1_branch
	canonizeStyles-step3.xslt 
Log Message:
correction bug retro convertion documents

Index: canonizeStyles-step3.xslt
===================================================================
RCS file: /cvsroot/castore/castore-core/src/data/retro/canonize/canonizeStyles-step3.xslt,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -C2 -d -r1.2.2.1 -r1.2.2.2
*** canonizeStyles-step3.xslt	21 Dec 2005 17:05:50 -0000	1.2.2.1
--- canonizeStyles-step3.xslt	6 Mar 2006 10:03:15 -0000	1.2.2.2
***************
*** 2,91 ****
  <!-- edited with XML Spy v4.0.1 U (http://www.xmlspy.com) by amalguy (XEROX) -->
  <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:manifest="http://openoffice.org/2001/manifest" xmlns:office="http://openoffice.org/2000/office" xmlns:meta="http://openoffice.org/2000/meta" xmlns:script="http://openoffice.org/2000/script" 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:chart="http://openoffice.org/2000/chart" xmlns:number="http://openoffice.org/2000/datastyle" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dr3d="http://openoffice.org/2000/dr3d" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="http://openoffice.org/2000/form" xmlns:config="http://openoffice.org/2001/config" xmlns:presentation="http://openoffice.org/2000/presentation" xmlns:reverse="urn:xgs:names:reverse:xmlns:reverse:2.0">
! 	<xsl:include href="../common/identity.xslt"/>
! 	<!--	Troisième étape de la transformation des styles définis hiérarchiquement (basé sur un autre style) 
  			en styles canoniques (basé sur aucun style) dans un document Open Office. 
  			Intégration dans chaque de son style utilisateur et le cas échéant de son style auto.
  			Voir le fichier de règles de la première étape (canonizeStyles-step1.xslt) pour le détail de cette transformation 
  	-->
! 	<xsl:key name="userstyleByName" match="/office:document/office:styles/style:style | /office:document/office:styles/text:list-style" use="@style:name"/>
! 	<xsl:key name="autostyleByName" match="/office:document/office:automatic-styles/style:style | /office:document/office:automatic-styles/text:list-style" use="@style:name"/>
! 	<xsl:template match="draw:image | draw:object | text:p | text:h | table:table | table:table-row | table:table-cell">
! 		<xsl:call-template name="incorporate-style"/>
! 	</xsl:template>
! 	<xsl:template name="incorporate-style">
! 		<xsl:variable name="based-user-style">
! 			<xsl:apply-templates select="." mode="based-user-style"/>
! 		</xsl:variable>
! 		<xsl:variable name="stylename" select="@table:style-name | @text:style-name | @draw:style-name"/>
! 		<xsl:variable name="autostyle" select="key('autostyleByName', $stylename)"/>
! 		<xsl:copy>
! 			<xsl:apply-templates select="@*"/>
! 			<xsl:if test="$based-user-style != ''">			
! 				<reverse:style>
! 					<xsl:copy-of select="key('userstyleByName', $based-user-style)"/>
! 				</reverse:style>
! 			</xsl:if>
! 			<xsl:if test="$autostyle">
! 				<reverse:auto-style>
! 					<xsl:copy-of select="$autostyle"/>
! 				</reverse:auto-style>
! 			</xsl:if>
! 			<xsl:apply-templates select="* | text()"/>
! 		</xsl:copy>
! 	</xsl:template>
! 	<xsl:template match="*" mode="based-user-style">
! 		<xsl:variable name="stylename" select="@table:style-name | @text:style-name | @draw:style-name"/>
! 		<xsl:variable name="style" select="key('userstyleByName', $stylename) | key('autostyleByName', $stylename)"/>
! 		<xsl:variable name="style.kind">
! 			<xsl:choose>
! 				<xsl:when test="$style[name(..) = 'office:styles']">user</xsl:when>
! 				<xsl:otherwise>auto</xsl:otherwise>
! 			</xsl:choose>
! 		</xsl:variable>
! 		<xsl:choose>
! 			<xsl:when test="$style.kind = 'user'">
! 				<xsl:value-of select="$stylename"/>
! 			</xsl:when>
! 			<xsl:when test="$style/@style:parent-style-name != ''">
! 				<xsl:value-of select="$style/@style:parent-style-name"/>
! 			</xsl:when>
! 			<xsl:otherwise>
! 				<xsl:if test="text:span">
! 					<xsl:apply-templates select="ancestor::text:*[self::text:p or self::text:h]" mode="based-user-style"/>
! 				</xsl:if>
! 			</xsl:otherwise>
! 		</xsl:choose>
! 	</xsl:template>
! 	<xsl:template match="table:table-column">
! 		<xsl:apply-templates select="." mode="copy">
! 			<xsl:with-param name="number-columns-repeated" select="@table:number-columns-repeated"/>
! 		</xsl:apply-templates>
! 	</xsl:template>
! 	<xsl:template match="table:table-column" mode="copy">
! 		<xsl:param name="number-columns-repeated"/>
! 		<xsl:call-template name="incorporate-style"/>
! 		<xsl:if test="$number-columns-repeated != 1">
! 			<xsl:apply-templates select="." mode="copy">
! 				<xsl:with-param name="number-columns-repeated" select="$number-columns-repeated - 1"/>
! 			</xsl:apply-templates>
! 		</xsl:if>
! 	</xsl:template>
! 	<xsl:template match="@table:number-columns-repeated">
! 		<xsl:attribute name="table:number-columns-repeated">1</xsl:attribute>
! 	</xsl:template>
! 	<xsl:template match="table:table/table:table-row[position()=1] | table:sub-table/table:table-row[position()=1]" priority="1">
! 		<table:table-rows>
! 			<xsl:call-template name="incorporate-style"/>
! 			<xsl:for-each select="following-sibling::table:table-row">
! 				<xsl:call-template name="incorporate-style"/>
! 			</xsl:for-each>
! 		</table:table-rows>
! 	</xsl:template>
! 	<xsl:template match="table:table/table:table-row[position()!=1] | table:sub-table/table:table-row[position()!=1]" priority="1"/>
! 	<xsl:template match="text:p[draw:*[@text:anchor-type='paragraph']]">
! 		<xsl:apply-templates select="draw:*[@text:anchor-type='paragraph']"/>
! 		<text:p>
! 			<xsl:apply-templates select="@* | *[not(self::draw:*[@text:anchor-type='paragraph'])] | text()"/>
! 		</text:p>
! 	</xsl:template>
  </xsl:transform>
--- 2,105 ----
  <!-- edited with XML Spy v4.0.1 U (http://www.xmlspy.com) by amalguy (XEROX) -->
  <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:manifest="http://openoffice.org/2001/manifest" xmlns:office="http://openoffice.org/2000/office" xmlns:meta="http://openoffice.org/2000/meta" xmlns:script="http://openoffice.org/2000/script" 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:chart="http://openoffice.org/2000/chart" xmlns:number="http://openoffice.org/2000/datastyle" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dr3d="http://openoffice.org/2000/dr3d" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="http://openoffice.org/2000/form" xmlns:config="http://openoffice.org/2001/config" xmlns:presentation="http://openoffice.org/2000/presentation" xmlns:reverse="urn:xgs:names:reverse:xmlns:reverse:2.0">
!   <xsl:include href="../common/identity.xslt"/>
!   <!--	Troisième étape de la transformation des styles définis hiérarchiquement (basé sur un autre style) 
  			en styles canoniques (basé sur aucun style) dans un document Open Office. 
  			Intégration dans chaque de son style utilisateur et le cas échéant de son style auto.
  			Voir le fichier de règles de la première étape (canonizeStyles-step1.xslt) pour le détail de cette transformation 
  	-->
!   <xsl:key name="userstyleByName" match="/office:document/office:styles/style:style | /office:document/office:styles/text:list-style" use="@style:name"/>
!   <xsl:key name="autostyleByName" match="/office:document/office:automatic-styles/style:style | /office:document/office:automatic-styles/text:list-style" use="@style:name"/>
!   <xsl:template match="draw:image | draw:object | text:p | text:h | table:table | table:table-row | table:table-cell">
!     <xsl:call-template name="incorporate-style"/>
!   </xsl:template>
!   <xsl:template name="incorporate-style">
!     <xsl:variable name="based-user-style">
!       <xsl:apply-templates select="." mode="based-user-style"/>
!     </xsl:variable>
!     <xsl:variable name="stylename" select="@table:style-name | @text:style-name | @draw:style-name"/>
!     <xsl:variable name="autostyle" select="key('autostyleByName', $stylename)"/>
!     <xsl:copy>
!       <xsl:apply-templates select="@*"/>
!       <xsl:if test="$based-user-style != ''">
!         <reverse:style>
!           <xsl:apply-templates select="key('userstyleByName', $based-user-style)"/>
!           <!--xsl:copy-of select="key('userstyleByName', $based-user-style)"/-->
!         </reverse:style>
!       </xsl:if>
!       <xsl:if test="$autostyle">
!         <reverse:auto-style>
!           <xsl:apply-templates select="$autostyle"/>
!           <!--xsl:copy-of select="$autostyle"/-->
!         </reverse:auto-style>
!       </xsl:if>
!       <xsl:apply-templates select="* | text()"/>
!     </xsl:copy>
!   </xsl:template>
!   <xsl:template match="*" mode="based-user-style">
!     <xsl:variable name="stylename" select="@table:style-name | @text:style-name | @draw:style-name"/>
!     <xsl:variable name="style" select="key('userstyleByName', $stylename) | key('autostyleByName', $stylename)"/>
!     <xsl:variable name="style.kind">
!       <xsl:choose>
!         <xsl:when test="$style[name(..) = 'office:styles']">user</xsl:when>
!         <xsl:otherwise>auto</xsl:otherwise>
!       </xsl:choose>
!     </xsl:variable>
!     <xsl:choose>
!       <xsl:when test="$style.kind = 'user'">
!         <xsl:value-of select="$stylename"/>
!       </xsl:when>
!       <xsl:when test="$style/@style:parent-style-name != ''">
!         <xsl:value-of select="$style/@style:parent-style-name"/>
!       </xsl:when>
!       <xsl:otherwise>
!         <xsl:if test="text:span">
!           <xsl:apply-templates select="ancestor::text:*[self::text:p or self::text:h]" mode="based-user-style"/>
!         </xsl:if>
!       </xsl:otherwise>
!     </xsl:choose>
!   </xsl:template>
!   <!-- Positionnement des attributs fo:font-style et fo:font-weight à normal si ces attributs ne sont pas présents -->
!   <xsl:template match="style:properties">
!     <xsl:copy>
!       <xsl:if test="not(@fo:font-style)">
!           <xsl:attribute name="fo:font-style">normal</xsl:attribute>
!       </xsl:if>
!       <xsl:if test="not(@fo:font-weight)">
!           <xsl:attribute name="fo:font-weight">normal</xsl:attribute>
!       </xsl:if>
!       <xsl:apply-templates select="@* | *"/>
!     </xsl:copy>
!   </xsl:template>
!   <xsl:template match="table:table-column">
!     <xsl:apply-templates select="." mode="copy">
!       <xsl:with-param name="number-columns-repeated" select="@table:number-columns-repeated"/>
!     </xsl:apply-templates>
!   </xsl:template>
!   <xsl:template match="table:table-column" mode="copy">
!     <xsl:param name="number-columns-repeated"/>
!     <xsl:call-template name="incorporate-style"/>
!     <xsl:if test="$number-columns-repeated != 1">
!       <xsl:apply-templates select="." mode="copy">
!         <xsl:with-param name="number-columns-repeated" select="$number-columns-repeated - 1"/>
!       </xsl:apply-templates>
!     </xsl:if>
!   </xsl:template>
!   <xsl:template match="@table:number-columns-repeated">
!     <xsl:attribute name="table:number-columns-repeated">1</xsl:attribute>
!   </xsl:template>
!   <xsl:template match="table:table/table:table-row[position()=1] | table:sub-table/table:table-row[position()=1]" priority="1">
!     <table:table-rows>
!       <xsl:call-template name="incorporate-style"/>
!       <xsl:for-each select="following-sibling::table:table-row">
!         <xsl:call-template name="incorporate-style"/>
!       </xsl:for-each>
!     </table:table-rows>
!   </xsl:template>
!   <xsl:template match="table:table/table:table-row[position()!=1] | table:sub-table/table:table-row[position()!=1]" priority="1"/>
!   <xsl:template match="text:p[draw:*[@text:anchor-type='paragraph']]">
!     <xsl:apply-templates select="draw:*[@text:anchor-type='paragraph']"/>
!     <text:p>
!       <xsl:apply-templates select="@* | *[not(self::draw:*[@text:anchor-type='paragraph'])] | text()"/>
!     </text:p>
!   </xsl:template>
  </xsl:transform>




Plus d'informations sur la liste de diffusion Castore-commits