- From: Eyrignoux Marc <eyrignou@yahoo.fr>
- Date: Tue, 20 Aug 2002 15:17:18 +0200 (CEST)
- To: www-xsl-fo@w3.org
Hello everybody,
I have a question about XSLT.
I am using FOP for getting nice PDF documents, and FOA
for writing the XSL stylesheet.
I have 1 XML file for the static contents
(static.XML), and a dynamic XML stream containing, for
example, calculated amounts.
For my tests, I have written a static file containing
sample amounts. Therefore, my XSL file refers to both
the XML files, and everything works fine.
But I don't know if it is possible to refer my dynamic
stream from the XSL file ?
Here are the files:
Here is an example of the dynamic stream:
<?xml version="1.0"?>
<structureResultat>
<dtSimulation>22/08/1976</dtSimulation>
</structureResultat>
Here is the static XML file:
<?xml version="1.0"?>
<static>
<title>My bank</title>
<paragraph>Your results on
<ext att="dtSimulation"/>
</paragraph>
</static>
As you know, FOA gives styles to the XML tags: for
example, the tag <title> will be printed bold, etc...
However, I have parametered my XSL file for searching
in the dynamic stream when the tag <ext> is
encountered.
The PDF file looks like:
My bank (with title style)
Your results on 22/08/1976 (with paragraph style)
My problem lies in the last part of the XSL file:
<xsl:apply-templates
select="document('dynamic.xml')/structureResultat/dtSimulation"/>
This line refers to a file, but I want it to refer to
the XML stream I gave to Xalan.
I have tried to write <xsl:apply-templates
select="structureResultat/dtSimulation"/>, but Xalan
seems not to detect the XML stream, since 22/08/1976
does not appear in the PDF file.
Here is the XSL file generated by FOA:
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:fox="http://xml.apache.org/fop/extensions"
xmlns:foa="http://fabio">
<xsl:import href="TablesAtts.xsl"></xsl:import>
<xsl:output method="xml" encoding="UTF-8"
indent="yes"></xsl:output>
<xsl:variable name="dots">l</xsl:variable>
<xsl:variable name="circles">m</xsl:variable>
<xsl:variable name="squares">n</xsl:variable>
<xsl:strip-space elements="row"></xsl:strip-space>
<xsl:template match="/">
<fo:root
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master margin-left="1cm"
page-width="210mm" margin-right="1cm"
margin-bottom="3cm" margin-top="2cm"
master-name="myPage" page-height="297mm">
<fo:region-body ></fo:region-body >
</fo:simple-page-master>
<fo:page-sequence-master master-name="mySeq">
<fo:repeatable-page-master-reference
master-reference="myPage"/>
</fo:page-sequence-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="mySeq">
<fo:flow flow-name="xsl-region-body">
<xsl:apply-templates
select="document('static.xml')/static"/>
</fo:flow >
</fo:page-sequence >
</fo:root>
</xsl:template>
<xsl:template match="static/title" foa:name="titre"
foa:class="block" foa:group="paragraph">
<fo:block foa:name="titre" foa:group="paragraph"
xsl:use-attribute-sets=" h1">
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<xsl:template match="static/paragraph"
foa:name="test" foa:class="block"
foa:group="paragraph">
<fo:block foa:name="test" foa:group="paragraph"
xsl:use-attribute-sets=" Normal">
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<xsl:template
match="static/paragraph/ext[@att='dtSimulation']"
foa:name="dtSimulation" foa:class="inline"
foa:group="emphasis">
<fo:inline foa:name="dtSimulation"
foa:group="emphasis" xsl:use-attribute-sets=" bold">
<xsl:apply-templates
select="document('dynamic.xml')/structureResultat/dtSimulation"/>
</fo:inline>
</xsl:template>
</xsl:stylesheet>
Thanks in advance,
Marc.
PS: I am registered to the list, but you can also
answer to eyrignou@yahoo.fr
=====
C'est au pied du mur qu'on voit le mieux le mur.
___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com
Received on Tuesday, 20 August 2002 09:17:20 UTC