Skip to content
Browse files

Added a new XSLT stylesheet that maeks it easier to deploy, as no pat…

…ch is needed any more with Word2FO stylesheets. More Docs.
  • Loading branch information...
1 parent ee72080 commit 88ee7a5b4678846869bcb0578c74e0587274d6bd @juanmf committed Nov 2, 2012
View
BIN reportPlugin/doc/HowToReport.docx
Binary file not shown.
View
306 reportPlugin/doc/Word2FO.patch
@@ -1,306 +0,0 @@
-diff -rupN c:\Word2FO/stylesheets/Word2FO.xsl C:\Users\juanmf\Work\siup\projects\aurora\src\aurora\plugins\reportPlugin\doc\Word2FO/stylesheets/Word2FO.xsl
---- c:\Word2FO/stylesheets/Word2FO.xsl Tue Feb 27 10:26:30 2007
-+++ C:\Users\juanmf\Work\siup\projects\aurora\src\aurora\plugins\reportPlugin\doc\Word2FO/stylesheets/Word2FO.xsl Fri Oct 19 13:00:53 2012
-@@ -83,6 +83,7 @@ marked by a commentary inside the templa
-
- <xsl:stylesheet xmlns:fo="http://www.w3.org/1999/XSL/Format"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-+ xmlns:aml="http://schemas.microsoft.com/aml/2001/core"
- xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml"
- version="2.0">
-
-@@ -144,16 +145,29 @@ marked by a commentary inside the templa
- <!-- MAIN ROOT TRANSFORM -->
- <!-- =================== -->
- <xsl:template match="/w:wordDocument">
--
-- <fo:root>
-- <!-- Set default font-family attribute on fo:root -->
-- <xsl:apply-templates select="w:fonts/w:defaultFonts"/>
--
-- <!-- Create physical page layout and generate page sequences -->
-- <xsl:call-template name="CreatePageLayout"/>
-- <xsl:call-template name="GeneratePageSequences"/>
--
-- </fo:root>
-+ <xsl:text disable-output-escaping="yes">&lt;</xsl:text>xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:php="http://php.net/xsl" xmlns:siup="http://siup.gov.ar/XSL/Format"<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
-+ <xsl:text disable-output-escaping="yes">&lt;</xsl:text>xsl:template match='/'<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
-+ <xsl:text disable-output-escaping="yes">&lt;</xsl:text>xsl:apply-templates select="root" /<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
-+ <xsl:text disable-output-escaping="yes">&lt;</xsl:text>/xsl:template<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
-+ <xsl:text disable-output-escaping="yes">&lt;</xsl:text>xsl:template match='root'<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
-+ <fo:root>
-+ <!-- Set default font-family attribute on fo:root -->
-+ <xsl:apply-templates select="w:fonts/w:defaultFonts"/>
-+
-+ <!-- Create physical page layout and generate page sequences -->
-+ <xsl:call-template name="CreatePageLayout"/>
-+ <xsl:call-template name="GeneratePageSequences"/>
-+ </fo:root>
-+ <xsl:text disable-output-escaping="yes">&lt;</xsl:text>/xsl:template<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
-+
-+ <xsl:apply-templates
-+ select="//w:tbl[w:tr[w:tc[w:p[w:r[aml:annotation[contains(aml:content, 'repeatTable')]]]]]]
-+ |//w:tr[w:tc[w:p[w:r[aml:annotation[contains(aml:content, 'repeatRow')]]]]]
-+ |//w:tc[w:p[w:r[aml:annotation[contains(aml:content, 'repeatCell')]]]]"
-+ mode="repetitive-template" /> <!--Esto rompe todo. -->
-+
-+ <xsl:text disable-output-escaping="yes">&lt;</xsl:text>/xsl:stylesheet<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
-+
- </xsl:template>
-
-
-diff -rupN c:\Word2FO/stylesheets/elementStructure.xsl C:\Users\juanmf\Work\siup\projects\aurora\src\aurora\plugins\reportPlugin\doc\Word2FO/stylesheets/elementStructure.xsl
---- c:\Word2FO/stylesheets/elementStructure.xsl Tue Feb 27 10:26:38 2007
-+++ C:\Users\juanmf\Work\siup\projects\aurora\src\aurora\plugins\reportPlugin\doc\Word2FO/stylesheets/elementStructure.xsl Thu Oct 18 23:46:39 2012
-@@ -572,6 +572,12 @@
- <fo:leader leader-length="0pt"/>
- <!-- text content -->
- <xsl:choose>
-+ <!-- juanmf@gmail.com: I'll use comments as the select attr value of xsl:value-of elements for the report template -->
-+ <!-- commmented "#" elements will render <xsl:value-of select=".//comment"/> -->
-+ <!--<xsl:when test="node()[text()='#']/../preceding-sibling::aml:annotation[@w:type='Word.Comment.Start']">-->
-+ <xsl:when test="text()='#' and ../following-sibling::aml:annotation[@w:type='Word.Comment.End']">
-+ <xsl:call-template name="Value-of-Selector" />
-+ </xsl:when>
- <xsl:when test="ancestor::w:fldSimple">
- <xsl:call-template name="ApplyFieldInstruction">
- <xsl:with-param name="instruction" select="normalize-space(ancestor::w:fldSimple/@w:instr)"/>
-@@ -593,6 +599,16 @@
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-+
-+ <!-- juanmf@gmail.com: I'll use comments as the select attr value of xsl:value-of elements for the report template -->
-+ <!-- commmented "#" elements will render <xsl:value-of select=".//comment"/> -->
-+ <!--<xsl:when test="node()[text()='#']/../preceding-sibling::aml:annotation[@w:type='Word.Comment.Start']">-->
-+ <xsl:template name="Value-of-Selector">
-+ <xsl:variable name="commentId" select="../following-sibling::aml:annotation[1]/@aml:id" />
-+ <xsl:variable name="nodeSelector" select="../../w:r/aml:annotation[@w:type='Word.Comment' and @aml:id=$commentId]/aml:content" />
-+ <xsl:text disable-output-escaping="yes">&lt;</xsl:text>xsl:value-of select=".//<xsl:value-of select="$nodeSelector"/>"<xsl:text disable-output-escaping="yes">/&gt;</xsl:text>
-+ </xsl:template>
-+
- <!-- ============================== -->
- <!-- Represents a symbol character. -->
- <!-- Parent elements: w:r. -->
-@@ -757,7 +773,7 @@
- <!-- ============================= -->
- <!-- Represents the table element. -->
- <!-- ============================= -->
-- <xsl:template match="w:tbl">
-+ <xsl:template match="w:tbl" name="w:tbl">
- <!-- Internal links -->
- <xsl:apply-templates select="aml:annotation"/>
- <fo:table>
-@@ -786,6 +802,26 @@
- </fo:table-body>
- </fo:table>
- </xsl:template>
-+
-+ <!--juanmf@gmail.com replace normal w:tbl transformation with an xsl:apply-tempates for repetitive tables -->
-+ <!--<xsl:template match="aml:annotation[contains(content, 'repeatTable')]/ancestor::w:tbl[1]" priority="1">-->
-+
-+ <xsl:template match="w:tbl[w:tr[w:tc[w:p[w:r[aml:annotation[contains(aml:content, 'repeatTable')]]]]]]" priority="1">
-+ <xsl:variable name="commentId" select="w:tr/w:tc/w:p/w:r/aml:annotation[contains(aml:content, 'repeatTable')][1]/@aml:id" />
-+ <xsl:variable name="nodeSelector" select="substring-after(.//aml:annotation[@w:type='Word.Comment' and @aml:id=$commentId]/aml:content, 'repeatTable ')" />
-+ <xsl:text disable-output-escaping="yes">&lt;xsl:apply-templates select=".//</xsl:text><xsl:value-of select="$nodeSelector"/>" mode="repetitive-table-<xsl:value-of select="$commentId"/>"<xsl:text disable-output-escaping="yes">/&gt;</xsl:text>
-+ </xsl:template>
-+
-+ <!--juanmf@gmail.com after closing fo:root this should get called to render repetitive row templates-->
-+ <xsl:template match="w:tbl[w:tr[w:tc[w:p[w:r[aml:annotation[contains(aml:content, 'repeatTable')]]]]]]" priority="1" mode="repetitive-template">
-+ <xsl:variable name="commentId" select="w:tr/w:tc/w:p/w:r/aml:annotation[contains(aml:content, 'repeatTable')][1]/@aml:id" />
-+ <xsl:variable name="nodeSelector" select="substring-after(.//aml:annotation[@w:type='Word.Comment' and @aml:id=$commentId]/aml:content, 'repeatTable ')" />
-+ <xsl:text disable-output-escaping="yes">&lt;xsl:template match="</xsl:text><xsl:value-of select="$nodeSelector"/>" mode="repetitive-table-<xsl:value-of select="$commentId"/>"<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
-+
-+ <xsl:call-template name="w:tbl"/>
-+
-+ <xsl:text disable-output-escaping="yes">&lt;/xsl:template&gt;</xsl:text>
-+ </xsl:template>
- <!-- ====================== -->
- <!-- Parent element: w:tbl. -->
- <!-- ====================== -->
-@@ -798,20 +834,37 @@
- <!-- ========================== -->
- <xsl:template match="w:gridCol">
- <fo:table-column>
-- <xsl:attribute name="column-number">
-+ <xsl:variable name="colNum">
- <xsl:number count="w:gridCol"/>
-+ </xsl:variable>
-+ <xsl:attribute name="column-number">
-+ <xsl:value-of select="$colNum"/>
- </xsl:attribute>
- <xsl:attribute name="column-width">
- <xsl:value-of select="@w:w div 20"/>
- <xsl:text>pt</xsl:text>
- </xsl:attribute>
-+ <!--juanmf@gmail.com when the number of cells is dinamyc, Apache FOP complains of fo:tablecolumn number missmatch adding -->
-+ <!--TODO: mi uso de $colNum PARECE ESTAR FALLANDO me genera
-+ column-number="1" number-columns-repeated="count(.//Dia) Bien.
-+ column-number="2" number-columns-repeated="count(.//Dia) Mal. Pero se ve que $colNum cambia de 1 a 2 y en ../../w:tr/w:tc[$colNum] siemrpe trae "Dia".-->
-+ <xsl:if test="../../w:tr/w:tc[position() = $colNum]/w:p/w:r/aml:annotation[contains(aml:content, 'repeatCell')]">
-+ <xsl:variable name="commentId" select="../../w:tr/w:tc[position() = $colNum]/w:p/w:r/aml:annotation[contains(aml:content, 'repeatCell')][1]/@aml:id" />
-+ <xsl:variable name="domRepetitiveNode" select="substring-after(../../w:tr/w:tc//aml:annotation[@w:type='Word.Comment' and @aml:id=$commentId]/aml:content, 'repeatCell ')" />
-+ <xsl:attribute name="number-columns-repeated">
-+ <!--XPath expression selecting count of repetitive nodes in XML consumed by generated report XSLT-->
-+ <!--<xsl:text disable-output-escaping="yes">&lt;xsl:value-of select="count(.//</xsl:text><xsl:value-of select="$domRepetitiveNode" /><xsl:text>)"></xsl:text>-->
-+ <xsl:text disable-output-escaping="yes">{count(.//</xsl:text><xsl:value-of select="$domRepetitiveNode" /><xsl:text>)}</xsl:text>
-+
-+ </xsl:attribute>
-+ </xsl:if>
- </fo:table-column>
- </xsl:template>
- <!-- ======================= -->
- <!-- Represents a table row. -->
- <!-- Parent element: w:tbl. -->
- <!-- ======================= -->
-- <xsl:template match="w:tr">
-+ <xsl:template match="w:tr" name="w:tr">
- <fo:table-row>
- <xsl:variable name="table-properties" select="ancestor::w:tbl/w:tblPr"/>
- <!-- xsl:if test="w:trPr/w:trHeight/@w:h-rule = 'exact'" -->
-@@ -831,11 +884,32 @@
- <xsl:apply-templates select="w:tc"/>
- </fo:table-row>
- </xsl:template>
-+
-+ <!--juanmf@gmail.com replace normal w:tc transformation with an xsl:apply-tempates for repetitive cells -->
-+ <!--<xsl:template match="aml:annotation[contains(content, 'repeatCell')]/ancestor::w:tc[1]" priority="1">-->
-+
-+ <xsl:template match="w:tr[w:tc[w:p[w:r[aml:annotation[contains(aml:content, 'repeatRow')]]]]]" priority="1">
-+ <xsl:variable name="commentId" select="w:tc/w:p/w:r/aml:annotation[contains(aml:content, 'repeatRow')][1]/@aml:id" />
-+ <xsl:variable name="nodeSelector" select="substring-after(.//aml:annotation[@w:type='Word.Comment' and @aml:id=$commentId]/aml:content, 'repeatRow ')" />
-+ <xsl:text disable-output-escaping="yes">&lt;xsl:apply-templates select=".//</xsl:text><xsl:value-of select="$nodeSelector"/>" mode="repetitive-row-<xsl:value-of select="$commentId"/>"<xsl:text disable-output-escaping="yes">/&gt;</xsl:text>
-+ </xsl:template>
-+
-+
-+ <!--juanmf@gmail.com after closing fo:root this should get called to render repetitive row templates-->
-+ <xsl:template match="w:tr[w:tc[w:p[w:r[aml:annotation[contains(aml:content, 'repeatRow')]]]]]" priority="1" mode="repetitive-template">
-+ <xsl:variable name="commentId" select="w:tc/w:p/w:r/aml:annotation[contains(aml:content, 'repeatRow')][1]/@aml:id" />
-+ <xsl:variable name="nodeSelector" select="substring-after(.//aml:annotation[@w:type='Word.Comment' and @aml:id=$commentId]/aml:content, 'repeatRow ')" />
-+ <xsl:text disable-output-escaping="yes">&lt;xsl:template match="</xsl:text><xsl:value-of select="$nodeSelector"/>" mode="repetitive-row-<xsl:value-of select="$commentId"/>"<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
-+
-+ <xsl:call-template name="w:tr"/>
-+
-+ <xsl:text disable-output-escaping="yes">&lt;/xsl:template&gt;</xsl:text>
-+ </xsl:template>
- <!-- ======================== -->
- <!-- Represents a table cell. -->
- <!-- Parent element: w:tr. -->
- <!-- ======================== -->
-- <xsl:template match="w:tc">
-+ <xsl:template match="w:tc" name="w:tc">
- <!-- should not generate fo:table-cell when the w:tc is spanned cell -->
- <xsl:if test="(not(w:tcPr/w:hmerge) or w:tcPr/w:hmerge/@w:val='restart') and (not(w:tcPr/w:vmerge) or w:tcPr/w:vmerge/@w:val='restart')">
- <fo:table-cell>
-@@ -889,6 +963,32 @@
- </fo:table-cell>
- </xsl:if>
- </xsl:template>
-+
-+ <!--juanmf@gmail.com replace normal w:tc transformation with an xsl:apply-tempates for repetitive cells -->
-+ <!--<xsl:template match="aml:annotation[contains(content, 'repeatCell')]/ancestor::w:tc[1]" priority="1">-->
-+
-+ <xsl:template match="w:tc[w:p[w:r[aml:annotation[contains(aml:content, 'repeatCell')]]]]" priority="1">
-+ <xsl:variable name="commentId" select="w:p/w:r/aml:annotation[contains(aml:content, 'repeatCell')][1]/@aml:id" />
-+ <xsl:variable name="nodeSelector" select="substring-after(.//aml:annotation[@w:type='Word.Comment' and @aml:id=$commentId]/aml:content, 'repeatCell ')" />
-+
-+ <xsl:text disable-output-escaping="yes">&lt;xsl:apply-templates select=".//</xsl:text>
-+ <xsl:value-of select="$nodeSelector"/>" mode="repetitive-cell-<xsl:value-of select="$commentId"/>"<xsl:text disable-output-escaping="yes">/&gt;</xsl:text>
-+
-+ </xsl:template>
-+
-+
-+ <!--juanmf@gmail.com after closing fo:root this should get called to render repetitive cell templates-->
-+ <xsl:template match="w:tc[w:p[w:r[aml:annotation[contains(aml:content, 'repeatCell')]]]]" priority="1" mode="repetitive-template">
-+ <xsl:variable name="commentId" select="w:p/w:r/aml:annotation[contains(aml:content, 'repeatCell')][1]/@aml:id" />
-+ <xsl:variable name="nodeSelector" select="substring-after(.//aml:annotation[@w:type='Word.Comment' and @aml:id=$commentId]/aml:content, 'repeatCell ')" />
-+
-+ <xsl:text disable-output-escaping="yes">&lt;xsl:template match="</xsl:text>
-+ <xsl:value-of select="$nodeSelector"/>" mode="repetitive-cell-<xsl:value-of select="$commentId"/>"<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
-+
-+ <xsl:call-template name="w:tc"/>
-+
-+ <xsl:text disable-output-escaping="yes">&lt;/xsl:template&gt;</xsl:text>
-+ </xsl:template>
- <!-- ========== -->
- <!-- Tabulation -->
- <!-- ========== -->
-@@ -992,6 +1092,23 @@
- <xsl:with-param name="y-factor" select="$y-factor"/>
- </xsl:apply-templates>
- </xsl:template>
-+
-+ <!-- juanmf@gmail.com: I'll use comments to replace embeded images in reports with data source xml nodes -->
-+ <xsl:template match="w:pict[ancestor::w:r[1]/following-sibling::aml:annotation[@w:type='Word.Comment.End']]" priority="1">
-+ <xsl:param name="x-factor" select="1"/>
-+ <xsl:param name="y-factor" select="1"/>
-+ <xsl:variable name="commentId" select="ancestor::w:r[1]/following-sibling::aml:annotation[@w:type='Word.Comment.End']/@aml:id" />
-+ <xsl:variable name="nodeSelector" select="ancestor::w:r[1]/following-sibling::w:r/aml:annotation[@w:type='Word.Comment' and @aml:id=$commentId]/aml:content" />
-+ <xsl:text disable-output-escaping="yes">&lt;</xsl:text>xsl:variable name="<xsl:value-of select="$nodeSelector"/>" select=".//<xsl:value-of select="$nodeSelector"/>"<xsl:text disable-output-escaping="yes">/&gt;</xsl:text>
-+
-+ <xsl:variable name="binary-data" select="w:binData | w:movie | w:background | w:applet | w:scriptAnchor | w:ocx | w:msAccessHTML"/>
-+ <xsl:apply-templates select="v:shape">
-+ <xsl:with-param name="binary-data" select="binary-data"/>
-+ <xsl:with-param name="x-factor" select="$x-factor"/>
-+ <xsl:with-param name="y-factor" select="$y-factor"/>
-+ </xsl:apply-templates>
-+ </xsl:template>
-+
- <!-- ======================================= -->
- <!-- Containes the reference to this object. -->
- <!-- ======================================= -->
-@@ -1065,6 +1182,36 @@
- </xsl:variable>
- <xsl:value-of select="concat('url(&quot;data:', $media-type, ';base64,', ., '&quot;)')"/>
- </xsl:template>
-+
-+ <!-- juanmf@gmail.com: I'll use comments to replace embeded images in reports with data source xml nodes -->
-+ <!--
-+ <aml:annotation aml:id="7" w:type="Word.Comment.Start"/>
-+ <w:r>
-+ <w:pict>
-+ <w:binData w:name="wordml://02000001.jpg" xml:space="preserve">
-+ </w:binData>
-+ </w:pict>
-+ </w:r>
-+ <aml:annotation aml:id="7" w:type="Word.Comment.End"/>
-+ <w:r>
-+ <aml:annotation aml:id="7" w:type="Word.Comment" aml:author="juanmf" aml:createdate="2012-10-16T00:32:00Z" w:initials="j">
-+ <aml:content></aml:content>
-+ </aml:annotation>
-+ </w:r>
-+ -->
-+ <xsl:template match="w:binData[ancestor::w:r[1]/following-sibling::aml:annotation[@w:type='Word.Comment.End']]" priority="1">
-+ <xsl:variable name="commentId" select="ancestor::w:r[1]/following-sibling::aml:annotation[@w:type='Word.Comment.End']/@aml:id" />
-+ <xsl:variable name="nodeSelector" select="ancestor::w:r[1]/following-sibling::w:r/aml:annotation[@w:type='Word.Comment' and @aml:id=$commentId]/aml:content" />
-+
-+ <xsl:variable name="media-type">
-+ <xsl:text>image/</xsl:text>
-+ <xsl:call-template name="RetrieveMediaSubtype">
-+ <xsl:with-param name="name" select="@w:name"/>
-+ </xsl:call-template>
-+ </xsl:variable>
-+ <xsl:value-of select="concat('url(&quot;data:', $media-type, ';base64,{$', $nodeSelector, '}&quot;)')"/>
-+ </xsl:template>
-+
- <!-- =========================================== -->
- <!-- Auxiliary information for image processing. -->
- <!-- =========================================== -->
-@@ -1133,6 +1280,9 @@
- <xsl:when test="@w:type='Word.Insertion' ">
- <xsl:apply-templates select="aml:content/*"/>
- </xsl:when>
-+ <!--xsl:when test="@w:type='Word.Comment' ">
-+ <xsl:apply-templates select="aml:content/*" mode="xslt"/>
-+ </xsl:when-->
- <xsl:otherwise/>
- </xsl:choose>
- </xsl:template>
-@@ -1148,6 +1298,7 @@
- <xsl:otherwise/>
- </xsl:choose>
- </xsl:template>
-+
- <!-- ========= -->
- <!-- Footnotes -->
- <!-- ========= -->
View
385 reportPlugin/doc/Word2XSLTRenderingFO.xsl
@@ -0,0 +1,385 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xsl:stylesheet xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:aml="http://schemas.microsoft.com/aml/2001/core"
+ xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml"
+ xmlns:v="urn:schemas-microsoft-com:vml"
+ version="2.0">
+
+
+ <!--<xsl:include href="./Word2FO/stylesheets/Word2FO.xsl"/>-->
+ <xsl:include href=".\Word2FO\stylesheets\Word2FO.xsl"/>
+
+ <!-- =================== -->
+ <!-- MAIN ROOT TRANSFORM -->
+ <!-- =================== -->
+ <xsl:template match="/w:wordDocument" priority="1">
+ <xsl:text disable-output-escaping="yes">&lt;</xsl:text>xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:php="http://php.net/xsl" xmlns:siup="http://siup.gov.ar/XSL/Format"<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
+ <xsl:text disable-output-escaping="yes">&lt;</xsl:text>xsl:template match='/'<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
+ <xsl:text disable-output-escaping="yes">&lt;</xsl:text>xsl:apply-templates select="root" /<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
+ <xsl:text disable-output-escaping="yes">&lt;</xsl:text>/xsl:template<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
+ <xsl:text disable-output-escaping="yes">&lt;</xsl:text>xsl:template match='root'<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
+ <fo:root>
+ <!-- Set default font-family attribute on fo:root -->
+ <xsl:apply-templates select="w:fonts/w:defaultFonts"/>
+
+ <!-- Create physical page layout and generate page sequences -->
+ <xsl:call-template name="CreatePageLayout"/>
+ <xsl:call-template name="GeneratePageSequences"/>
+ </fo:root>
+ <xsl:text disable-output-escaping="yes">&lt;</xsl:text>/xsl:template<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
+
+ <xsl:apply-templates
+ select="//w:tbl[w:tr[w:tc[w:p[w:r[aml:annotation[contains(aml:content, 'repeatTable')]]]]]]
+ |//w:tr[w:tc[w:p[w:r[aml:annotation[contains(aml:content, 'repeatRow')]]]]]
+ |//w:tc[w:p[w:r[aml:annotation[contains(aml:content, 'repeatCell')]]]]"
+ mode="repetitive-template" />
+ <!--Esto rompe todo. -->
+
+ <xsl:text disable-output-escaping="yes">&lt;</xsl:text>/xsl:stylesheet<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
+
+ </xsl:template>
+ <!-- ======================== -->
+ <!-- Represents text content. -->
+ <!-- Parent elements: w:r. -->
+ <!-- ======================== -->
+ <xsl:template match="w:t[text()='#' and ../following-sibling::aml:annotation[@w:type='Word.Comment.End']]" priority="1">
+ <!-- Preserve initial whitespace characters. -->
+ <!-- fo:leader with zero lenght affects on white-space-treatment: -->
+ <!-- initial white-space characters are not surround line-feed now. -->
+ <fo:leader leader-length="0pt"/>
+ <!-- text content -->
+
+ <!-- juanmf@gmail.com: I'll use comments as the select attr value of xsl:value-of elements for the report template -->
+ <!-- commmented "#" elements will render <xsl:value-of select=".//comment"/> -->
+ <!--<xsl:when test="node()[text()='#']/../preceding-sibling::aml:annotation[@w:type='Word.Comment.Start']">-->
+ <xsl:call-template name="Value-of-Selector" />
+ </xsl:template>
+
+ <!-- juanmf@gmail.com: I'll use comments as the select attr value of xsl:value-of elements for the report template -->
+ <!-- commmented "#" elements will render <xsl:value-of select=".//comment"/> -->
+ <!-- Where .// prefix in ".//comment" will depend on the existence of a function or an absolute path in the comment expression-->
+ <!--<xsl:when test="node()[text()='#']/../preceding-sibling::aml:annotation[@w:type='Word.Comment.Start']">-->
+ <xsl:template name="Value-of-Selector">
+ <xsl:variable name="commentId" select="../following-sibling::aml:annotation[1]/@aml:id" />
+ <xsl:variable name="nodeSelector" select="../../w:r/aml:annotation[@w:type='Word.Comment' and @aml:id=$commentId]/aml:content" />
+ <xsl:variable name="prefix" >
+ <!--select="'.//'"-->
+ <xsl:if test="not(contains($nodeSelector, '(')) and not(contains($nodeSelector, '//'))">
+ <xsl:text>.//</xsl:text>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:if test="contains($nodeSelector, '[position()]')">
+ <xsl:text disable-output-escaping="yes">&lt;</xsl:text>xsl:variable name="pos" select="position()"<xsl:text disable-output-escaping="yes">/></xsl:text>
+</xsl:if>
+
+<xsl:variable name="processedNodeSelector" >
+ <!--select="'.//'"-->
+ <xsl:call-template name="replace-string">
+ <xsl:with-param name="text" select="$nodeSelector"/>
+ <xsl:with-param name="replace" select="'[position()]'"/>
+ <xsl:with-param name="with" select="'[position() = $pos]'"/>
+ </xsl:call-template>
+</xsl:variable>
+<xsl:text disable-output-escaping="yes">&lt;</xsl:text>xsl:value-of select="<xsl:value-of select="concat($prefix, $processedNodeSelector)"/>"<xsl:text disable-output-escaping="yes">/></xsl:text>
+</xsl:template>
+
+
+<!-- ================ -->
+<!-- Tabular elements -->
+<!-- ================ -->
+<!-- ============================= -->
+<!-- Represents the table element. -->
+<!-- ============================= -->
+<xsl:template name="w:tbl" >
+ <!-- Internal links -->
+ <xsl:apply-templates select="aml:annotation"/>
+ <fo:table>
+ <!-- Set default-style table properties -->
+ <xsl:apply-templates select="$default-table-style"/>
+ <!-- Set style-level table properties -->
+ <xsl:apply-templates select="key('styles', w:tblPr/w:tblStyle/@w:val)[@w:type='table']"/>
+ <!-- Set direct table properties -->
+ <xsl:apply-templates select="w:tblPr/*[not(self::w:tblStyle) and not(self::w:tblCellMar)]"/>
+ <!-- Set table columns -->
+ <xsl:apply-templates select="w:tblGrid"/>
+ <!-- table-header -->
+ <!-- 03/05/2006: Need to add w: namepace to tblHeader to fix a bug in the application of repeating table header -->
+ <xsl:variable name="header-rows" select="w:tr[w:trPr/w:tblHeader[not(@w:val='off')]]"/>
+ <xsl:if test="$header-rows">
+ <fo:table-header start-indent="0pt" end-indent="0pt">
+ <xsl:apply-templates select="$header-rows"/>
+ </fo:table-header>
+ </xsl:if>
+ <fo:table-body start-indent="0pt" end-indent="0pt">
+ <!-- There are situations when child of w:tbl is not from standard namespace.-->
+ <!-- Currently style sheet does not support rendering of such elements. -->
+ <!-- e.g. Smart-tag can contain w:tr element. -->
+ <!-- TODO: Add w: namepace to tblHeader to fix a bug in the application of repeating table header -->
+ <xsl:apply-templates select="*[self::w:tr[not(w:trPr/w:tblHeader) or w:trPr/w:tblHeader/@w:val='off'] or not(contains($standard-namespace-prefixes, concat(' ', substring-before(name(), ':'), ' ')))]"/>
+ </fo:table-body>
+ </fo:table>
+</xsl:template>
+
+<!--juanmf@gmail.com replace normal w:tbl transformation with an xsl:apply-tempates for repetitive tables -->
+<!--<xsl:template match="aml:annotation[contains(content, 'repeatTable')]/ancestor::w:tbl[1]" priority="1">-->
+
+<xsl:template match="w:tbl[w:tr[w:tc[w:p[w:r[aml:annotation[contains(aml:content, 'repeatTable')]]]]]]" priority="2">
+ <xsl:variable name="commentId" select="w:tr/w:tc/w:p/w:r/aml:annotation[contains(aml:content, 'repeatTable')][1]/@aml:id" />
+ <xsl:variable name="nodeSelector" select="substring-after(.//aml:annotation[@w:type='Word.Comment' and @aml:id=$commentId]/aml:content, 'repeatTable ')" />
+ <xsl:text disable-output-escaping="yes">&lt;xsl:apply-templates select=".//</xsl:text>
+ <xsl:value-of select="$nodeSelector"/>" mode="repetitive-table-<xsl:value-of select="$commentId"/>"<xsl:text disable-output-escaping="yes">/&gt;</xsl:text>
+</xsl:template>
+
+<!--juanmf@gmail.com after closing fo:root this should get called to render repetitive row templates-->
+<xsl:template match="w:tbl[w:tr[w:tc[w:p[w:r[aml:annotation[contains(aml:content, 'repeatTable')]]]]]]" priority="1" mode="repetitive-template">
+ <xsl:variable name="commentId" select="w:tr/w:tc/w:p/w:r/aml:annotation[contains(aml:content, 'repeatTable')][1]/@aml:id" />
+ <xsl:variable name="nodeSelector" select="substring-after(.//aml:annotation[@w:type='Word.Comment' and @aml:id=$commentId]/aml:content, 'repeatTable ')" />
+ <xsl:text disable-output-escaping="yes">&lt;xsl:template match="</xsl:text>
+ <xsl:value-of select="$nodeSelector"/>" mode="repetitive-table-<xsl:value-of select="$commentId"/>"<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
+
+ <xsl:call-template name="w:tbl"/>
+
+ <xsl:text disable-output-escaping="yes">&lt;/xsl:template&gt;</xsl:text>
+</xsl:template>
+
+<!-- ========================== -->
+<!-- Represents a table column. -->
+<!-- Parent element: w:tblGrid. -->
+<!-- ========================== -->
+<xsl:template match="w:gridCol" priority="1">
+ <fo:table-column>
+ <xsl:variable name="colNum">
+ <xsl:number count="w:gridCol"/>
+ </xsl:variable>
+ <xsl:attribute name="column-number">
+ <xsl:value-of select="$colNum"/>
+ </xsl:attribute>
+ <xsl:attribute name="column-width">
+ <xsl:value-of select="@w:w div 20"/>
+ <xsl:text>pt</xsl:text>
+ </xsl:attribute>
+ <!--juanmf@gmail.com when the number of cells is dinamyc, Apache FOP complains of fo:tablecolumn number missmatch adding -->
+ <!--TODO: mi uso de $colNum PARECE ESTAR FALLANDO me genera
+ column-number="1" number-columns-repeated="count(.//Dia) Bien.
+ column-number="2" number-columns-repeated="count(.//Dia) Mal. Pero se ve que $colNum cambia de 1 a 2 y en ../../w:tr/w:tc[$colNum] siemrpe trae "Dia".-->
+ <xsl:if test="../../w:tr/w:tc[position() = $colNum]/w:p/w:r/aml:annotation[contains(aml:content, 'repeatCell')]">
+ <xsl:variable name="commentId" select="../../w:tr/w:tc[position() = $colNum]/w:p/w:r/aml:annotation[contains(aml:content, 'repeatCell')][1]/@aml:id" />
+ <xsl:variable name="domRepetitiveNode" select="substring-after(../../w:tr/w:tc//aml:annotation[@w:type='Word.Comment' and @aml:id=$commentId]/aml:content, 'repeatCell ')" />
+ <xsl:attribute name="number-columns-repeated">
+ <!--XPath expression selecting count of repetitive nodes in XML consumed by generated report XSLT-->
+ <!--<xsl:text disable-output-escaping="yes">&lt;xsl:value-of select="count(.//</xsl:text><xsl:value-of select="$domRepetitiveNode" /><xsl:text>)"></xsl:text>-->
+ <xsl:text disable-output-escaping="yes">{count(.//</xsl:text>
+ <xsl:value-of select="$domRepetitiveNode" />
+ <xsl:text>)}</xsl:text>
+
+ </xsl:attribute>
+ </xsl:if>
+ </fo:table-column>
+</xsl:template>
+<!-- ======================= -->
+<!-- Represents a table row. -->
+<!-- Parent element: w:tbl. -->
+<!-- ======================= -->
+<xsl:template name="w:tr">
+ <fo:table-row>
+ <xsl:variable name="table-properties" select="ancestor::w:tbl/w:tblPr"/>
+ <!-- xsl:if test="w:trPr/w:trHeight/@w:h-rule = 'exact'" -->
+ <xsl:if test="w:trPr/w:trHeight/@w:h-rule = 'exact'">
+ <xsl:attribute name="height">
+ <xsl:value-of select="concat(w:trPr/w:trHeight/@w:val div 20, 'pt' )"/>
+ </xsl:attribute>
+ </xsl:if>
+ <!-- Set default-style table-row properties -->
+ <xsl:apply-templates select="$default-table-style" mode="table-rows"/>
+ <!-- Set style-level table-row properties -->
+ <xsl:apply-templates
+ select="key('styles', $table-properties/w:tblStyle/@w:val)[@w:type='table']" mode="table-rows"/>
+ <!-- Overriden table properties for the row -->
+ <xsl:apply-templates select="w:tblPrEx/*"/>
+ <!-- Set direct table-row properties -->
+ <xsl:apply-templates select="w:trPr/*"/>
+ <!-- Generate table cells -->
+ <xsl:apply-templates select="w:tc"/>
+ </fo:table-row>
+</xsl:template>
+
+<!--juanmf@gmail.com replace normal w:tc transformation with an xsl:apply-tempates for repetitive cells -->
+<!--<xsl:template match="aml:annotation[contains(content, 'repeatCell')]/ancestor::w:tc[1]" priority="1">-->
+
+<xsl:template match="w:tr[w:tc[w:p[w:r[aml:annotation[contains(aml:content, 'repeatRow')]]]]]" priority="1">
+ <xsl:variable name="commentId" select="w:tc/w:p/w:r/aml:annotation[contains(aml:content, 'repeatRow')][1]/@aml:id" />
+ <xsl:variable name="nodeSelector" select="substring-after(.//aml:annotation[@w:type='Word.Comment' and @aml:id=$commentId]/aml:content, 'repeatRow ')" />
+ <xsl:text disable-output-escaping="yes">&lt;xsl:apply-templates select=".//</xsl:text>
+ <xsl:value-of select="$nodeSelector"/>" mode="repetitive-row-<xsl:value-of select="$commentId"/>"<xsl:text disable-output-escaping="yes">/&gt;</xsl:text>
+</xsl:template>
+
+
+<!--juanmf@gmail.com after closing fo:root this should get called to render repetitive row templates-->
+<xsl:template match="w:tr[w:tc[w:p[w:r[aml:annotation[contains(aml:content, 'repeatRow')]]]]]" priority="1" mode="repetitive-template">
+ <xsl:variable name="commentId" select="w:tc/w:p/w:r/aml:annotation[contains(aml:content, 'repeatRow')][1]/@aml:id" />
+ <xsl:variable name="nodeSelector" select="substring-after(.//aml:annotation[@w:type='Word.Comment' and @aml:id=$commentId]/aml:content, 'repeatRow ')" />
+ <xsl:text disable-output-escaping="yes">&lt;xsl:template match="</xsl:text>
+ <xsl:value-of select="$nodeSelector"/>" mode="repetitive-row-<xsl:value-of select="$commentId"/>"<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
+
+ <xsl:call-template name="w:tr"/>
+
+ <xsl:text disable-output-escaping="yes">&lt;/xsl:template&gt;</xsl:text>
+</xsl:template>
+<!-- ======================== -->
+<!-- Represents a table cell. -->
+<!-- Parent element: w:tr. -->
+<!-- ======================== -->
+<xsl:template name="w:tc">
+ <!-- should not generate fo:table-cell when the w:tc is spanned cell -->
+ <xsl:if test="(not(w:tcPr/w:hmerge) or w:tcPr/w:hmerge/@w:val='restart') and (not(w:tcPr/w:vmerge) or w:tcPr/w:vmerge/@w:val='restart')">
+ <fo:table-cell>
+ <xsl:variable name="table-properties" select="ancestor::w:tbl[1]/w:tblPr"/>
+ <xsl:variable name="table-properties-ex" select="ancestor::w:tr[1]/w:tblPrEx"/>
+ <!-- Set default-style table-cell properties -->
+ <!-- xsl:if test="w:tcPr/w:tcW/@w:w">
+ <xsl:attribute name="width"><xsl:value-of select="concat(w:tcPr/w:tcW/@w:w div 20, 'pt' )"/></xsl:attribute>
+ </xsl:if -->
+ <xsl:if test="../w:trPr/w:trHeight/@w:h-rule = 'exact'">
+ <xsl:attribute name="height">
+ <xsl:value-of select="concat(../w:trPr/w:trHeight/@w:val div 20, 'pt' )"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="$default-table-style" mode="table-cells">
+ <xsl:with-param name="cell" select="."/>
+ </xsl:apply-templates>
+ <!-- Set style-level table-cell properties -->
+ <xsl:apply-templates
+ select="key('styles', $table-properties/w:tblStyle/@w:val)[@w:type='table']" mode="table-cells">
+ <xsl:with-param name="cell" select="."/>
+ </xsl:apply-templates>
+ <!-- Apply direct table-cell properties defined on table level -->
+ <xsl:apply-templates select="$table-properties/w:tblBorders/*">
+ <xsl:with-param name="cell" select="."/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="$table-properties-ex/w:tblBorders/*">
+ <xsl:with-param name="cell" select="."/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="$table-properties/w:tblCellMar"/>
+ <!-- Set direct table-cell properties -->
+ <xsl:apply-templates select="w:tcPr/*">
+ <xsl:with-param name="cell" select="."/>
+ </xsl:apply-templates>
+
+ <fo:block-container>
+
+ <xsl:if test="w:tcPr/w:textFlow/@w:val = 'bt-lr' or w:tcPr/w:textFlow/@w:val = 'tb-rl' ">
+ <xsl:attribute name="width">
+ <xsl:value-of select="concat(../w:trPr/w:trHeight/@w:val div 20, 'pt' )"/>
+ </xsl:attribute>
+ <xsl:attribute name="reference-orientation">
+ <xsl:choose>
+ <xsl:when test="w:tcPr/w:textFlow/@w:val = 'bt-lr' ">90</xsl:when>
+ <xsl:when test="w:tcPr/w:textFlow/@w:val = 'tb-rl' ">-90</xsl:when>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+
+ <!-- The table cell content -->
+ <xsl:apply-templates select="*[not(self::w:tcPr)]"/>
+
+ </fo:block-container>
+
+ </fo:table-cell>
+ </xsl:if>
+</xsl:template>
+
+<!--juanmf@gmail.com replace normal w:tc transformation with an xsl:apply-tempates for repetitive cells -->
+<!--<xsl:template match="aml:annotation[contains(content, 'repeatCell')]/ancestor::w:tc[1]" priority="1">-->
+
+<xsl:template match="w:tc[w:p[w:r[aml:annotation[contains(aml:content, 'repeatCell')]]]]" priority="1">
+ <xsl:variable name="commentId" select="w:p/w:r/aml:annotation[contains(aml:content, 'repeatCell')][1]/@aml:id" />
+ <xsl:variable name="nodeSelector" select="substring-after(.//aml:annotation[@w:type='Word.Comment' and @aml:id=$commentId]/aml:content, 'repeatCell ')" />
+
+ <xsl:text disable-output-escaping="yes">&lt;xsl:apply-templates select=".//</xsl:text>
+ <xsl:value-of select="$nodeSelector"/>" mode="repetitive-cell-<xsl:value-of select="$commentId"/>"<xsl:text disable-output-escaping="yes">/&gt;</xsl:text>
+
+</xsl:template>
+
+
+<!--juanmf@gmail.com after closing fo:root this should get called to render repetitive cell templates-->
+<xsl:template match="w:tc[w:p[w:r[aml:annotation[contains(aml:content, 'repeatCell')]]]]" priority="1" mode="repetitive-template">
+ <xsl:variable name="commentId" select="w:p/w:r/aml:annotation[contains(aml:content, 'repeatCell')][1]/@aml:id" />
+ <xsl:variable name="nodeSelector" select="substring-after(.//aml:annotation[@w:type='Word.Comment' and @aml:id=$commentId]/aml:content, 'repeatCell ')" />
+
+ <xsl:text disable-output-escaping="yes">&lt;xsl:template match="</xsl:text>
+ <xsl:value-of select="$nodeSelector"/>" mode="repetitive-cell-<xsl:value-of select="$commentId"/>"<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
+
+ <xsl:call-template name="w:tc"/>
+
+ <xsl:text disable-output-escaping="yes">&lt;/xsl:template&gt;</xsl:text>
+</xsl:template>
+<!-- ======== -->
+<!-- Graphics -->
+<!-- ======== -->
+<!-- =========================================== -->
+<!-- Represents a picture or other binary object -->
+<!-- that appears at this point in the document. -->
+<!-- Parent elements: w:r -->
+<!-- =========================================== -->
+<!-- juanmf@gmail.com: I'll use comments to replace embeded images in reports with data source xml nodes -->
+<xsl:template match="w:pict[ancestor::w:r[1]/following-sibling::aml:annotation[@w:type='Word.Comment.End']]" priority="1">
+ <xsl:param name="x-factor" select="1"/>
+ <xsl:param name="y-factor" select="1"/>
+ <xsl:variable name="commentId" select="ancestor::w:r[1]/following-sibling::aml:annotation[@w:type='Word.Comment.End']/@aml:id" />
+ <xsl:variable name="nodeSelector" select="ancestor::w:r[1]/following-sibling::w:r/aml:annotation[@w:type='Word.Comment' and @aml:id=$commentId]/aml:content" />
+ <xsl:variable name="varName" select="concat('chart_', $commentId)" />
+ <xsl:text disable-output-escaping="yes">&lt;</xsl:text>xsl:variable name="<xsl:value-of select="$varName"/>" select=".//<xsl:value-of select="$nodeSelector"/>"<xsl:text disable-output-escaping="yes">/&gt;</xsl:text>
+
+ <xsl:variable name="binary-data" select="w:binData | w:movie | w:background | w:applet | w:scriptAnchor | w:ocx | w:msAccessHTML"/>
+ <xsl:apply-templates select="v:shape">
+ <xsl:with-param name="binary-data" select="binary-data"/>
+ <xsl:with-param name="x-factor" select="$x-factor"/>
+ <xsl:with-param name="y-factor" select="$y-factor"/>
+ </xsl:apply-templates>
+
+</xsl:template>
+
+ <!-- ================================================== -->
+ <!-- Contains the binary data representing this object. -->
+ <!-- Parent elements: w:pict, w:bgPict -->
+ <!-- ================================================== -->
+ <xsl:template match="w:binData[ancestor::w:r[1]/following-sibling::aml:annotation[@w:type='Word.Comment.End']]" priority="1">
+ <xsl:variable name="commentId" select="ancestor::w:r[1]/following-sibling::aml:annotation[@w:type='Word.Comment.End']/@aml:id" />
+ <xsl:variable name="varName" select="concat('chart_', $commentId)" />
+
+ <xsl:variable name="media-type">
+ <xsl:text>image/</xsl:text>
+ <xsl:call-template name="RetrieveMediaSubtype">
+ <xsl:with-param name="name" select="@w:name"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat('url(&quot;data:', $media-type, ';base64,{$', $varName, '}&quot;)')"/>
+ </xsl:template>
+
+<!-- ================================================== -->
+<!-- Auxiliary functions -->
+<!-- ================================================== -->
+<xsl:template name="replace-string">
+ <xsl:param name="text"/>
+ <xsl:param name="replace"/>
+ <xsl:param name="with"/>
+ <xsl:choose>
+ <xsl:when test="contains($text,$replace)">
+ <xsl:value-of select="substring-before($text,$replace)"/>
+ <xsl:value-of select="$with"/>
+ <xsl:call-template name="replace-string">
+ <xsl:with-param name="text" select="substring-after($text,$replace)"/>
+ <xsl:with-param name="replace" select="$replace"/>
+ <xsl:with-param name="with" select="$with"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$text"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+</xsl:stylesheet>
+
+
View
163 reportPlugin/lib/RenderStep1/LogicalScreenCallbacks.php
@@ -51,31 +51,84 @@ public static function howToSimple()
{
$xml = <<<XML
<root>
- <Node>
- <SubNode>Some Text</SubNode>
- </Node>
- <row>
- <Column>
- <day>15</day>
- </Column>
- <Column>
- <day>5</day>
- </Column>
- <Column>
- <day>17</day>
- </Column>
- </row>
- <row>
- <Column>
- <day>1</day>
- </Column>
- <Column>
- <day>10</day>
- </Column>
- <Column>
- <day>25</day>
- </Column>
- </row>
+ <CirugiasProgramadas_Collection>
+ <CirugiasProgramadas><!--Scheduled surgery [1]-->
+ <servicio>Cardiología</servicio><!--1st Service name-->
+ <cantidad_dia>
+ <cantidad>0</cantidad><!--surgery count-->
+ <dia>01</dia><!--day-->
+ </cantidad_dia>
+ <cantidad_dia>
+ <cantidad>0</cantidad><!--surgery count-->
+ <dia>02</dia><!--day-->
+ </cantidad_dia>
+ <cantidad_dia>
+ <cantidad>1</cantidad><!--surgery count-->
+ <dia>30</dia><!--30th day of the month-->
+ </cantidad_dia>
+ </CirugiasProgramadas>
+ <CirugiasProgramadas><!--Scheduled surgery [1]-->
+ <servicio>Urología</servicio><!--5th Service name-->
+ <cantidad_dia>
+ <cantidad>0</cantidad><!--surgery count-->
+ <dia>01</dia><!--day-->
+ </cantidad_dia>
+ <cantidad_dia>
+ <cantidad>0</cantidad><!--surgery count-->
+ <dia>02</dia><!--day-->
+ </cantidad_dia>
+ <cantidad_dia>
+ <cantidad>1</cantidad><!--surgery count-->
+ <dia>30</dia><!--30th day of the month-->
+ </cantidad_dia>
+ </CirugiasProgramadas>
+ </CirugiasProgramadas_Collection>
+</root>
+XML;
+ $q = new DOMDocument();
+ $q->loadXML($xml);
+ return $q;
+ }
+ /**
+ * Dummy method, this method gets called by LayoutManager::render(). Which
+ * gets informed by the config file sfExportConfig.yml's:
+ * <pre>
+ * .step1:
+ * . logical_screen_callback: [LogicalScreenCallbacks, helloworld] # here is the callback!
+ * . callback_params: ~ # No params this time!
+ * </pre>
+
+ * This method generates the xml data for the 'How to create a simple Report'
+ * topic of the Report Engine tutorial
+ *
+ * @return DomDocument With the XMLRawData that hsould be processed in Step2
+ * @see LayoutManager::render()
+ */
+ public static function howToControlBreak()
+ {
+ $xml = <<<XML
+<root>
+ <lvl1>
+ <lvl1Name>Cars from World</lvl1Name>
+ <lvl2>
+ <lvl2Name>Cars from America</lvl2Name>
+ <lvl3>
+ <lvl3Name>Cars from Argentina</lvl3Name>
+ <lvl4>
+ <lvl4Name>Cars from Corrientes</lvl4Name>
+ </lvl4>
+ <lvl4>
+ <lvl4Name>Cars from Chaco</lvl4Name>
+ </lvl4>
+ </lvl3>
+ <lvl3>
+ <lvl3Name>Cars from Brasil</lvl3Name>
+ <lvl4>
+ <lvl4Name>Cars from Rio de Janeiro</lvl4Name>
+ </lvl4>
+ </lvl3>
+ </lvl2>
+ </lvl1>
</root>
XML;
$q = new DOMDocument();
@@ -136,43 +189,29 @@ public static function listadoPersonas()
*/
public static function listadoPersonasXedad()
{
- // $q = Doctrine_Query::create()
- // ->from('Persona p')
- // ->innerJoin('p.PersonaDomicilio pd')
- // ->innerJoin('pd.Domicilio d')
- // ->innerJoin('d.Localidad l')
- //// ->select('p.nro_documento, p.nombre, YEAR(p.fecha_nacimiento)')
- // ->limit(6)
- // ->execute(array(), 'xml');
- // /* @var $q DomDocument */
- //
- // $birthYearCount = Doctrine_Query::create()
- // ->from('Persona p')
- // ->select('YEAR(p.fecha_nacimiento) as years, count(YEAR(p.fecha_nacimiento)) as counted')
- // ->groupBy('years')
- // ->orderBy('years')
- // ->limit(6)
- // ->execute(array(), 'xml');
- //
- // $chart = ListPersonasEdadCharts::listadoPersonasXedadCreateChart($birthYearCount);
- // $encodedChart = base64_encode($chart);
- //
- // $chartNode = $q->createElement('chart', $encodedChart);
- // $q->documentElement->appendChild($chartNode);
- $xml = <<<XML
-<root>
- <Node>
- <SubNode>Some Text</SubNode>
- </Node>
- <date>
- <day>15</day>
- <month>6</month>
- <year>2012</year>
- </date>
-</root>
-XML;
- $q = new DOMDocument();
- $q->loadXML($xml);
+ $q = Doctrine_Query::create()
+ ->from('Persona p')
+ ->innerJoin('p.PersonaDomicilio pd')
+ ->innerJoin('pd.Domicilio d')
+ ->innerJoin('d.Localidad l')
+ ->select('p.nro_documento, p.nombre, YEAR(p.fecha_nacimiento)')
+ ->limit(6)
+ ->execute(array(), 'xml');
+ /* @var $q DomDocument */
+
+ $birthYearCount = Doctrine_Query::create()
+ ->from('Persona p')
+ ->select('YEAR(p.fecha_nacimiento) as years, count(YEAR(p.fecha_nacimiento)) as counted')
+ ->groupBy('years')
+ ->orderBy('years')
+ ->limit(6)
+ ->execute(array(), 'xml');
+
+ $chart = ListPersonasEdadCharts::listadoPersonasXedadCreateChart($birthYearCount);
+ $encodedChart = base64_encode($chart);
+
+ $chartNode = $q->createElement('chart', $encodedChart);
+ $q->documentElement->appendChild($chartNode);
return $q;
}

0 comments on commit 88ee7a5

Please sign in to comment.
Something went wrong with that request. Please try again.