You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Gerald Michalitz <ge...@aon.at> on 2002/07/31 01:10:21 UTC
xsl:fo problem not getting data from the javascript
hallo
sorry for the long code but i need a little help (please)
my page2fo-javascript.xsl has this
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:lxslt="http://xml.apache.org/xslt"
xmlns:my-ext="ext1"
extension-element-prefixes="my-ext">
<xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="page"
page-height="29.7cm"
page-width="21cm"
margin-top="1cm"
margin-bottom="2cm"
margin-left="2.5cm"
margin-right="2.5cm">
<fo:region-before extent="3cm"/>
<fo:region-body margin-top="3cm"/>
<fo:region-after extent="1.5cm"/>
</fo:simple-page-master>
<fo:page-sequence-master master-name="all">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference master-reference="page"
page-position="first"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="all">
<fo:static-content flow-name="xsl-region-after">
<fo:block text-align="right"
font-size="10pt"
font-family="serif"
line-height="14pt">Seite: <fo:page-number/></fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<xsl:apply-templates/>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="title">
<fo:block font-size="36pt" space-before.optimum="24pt"
text-align="center"><xsl:apply-templates/></fo:block>
</xsl:template>
<xsl:template match="para">
<fo:block font-size="12pt" space-before.optimum="12pt"
text-align="center"><xsl:apply-templates/></fo:block>
</xsl:template>
<lxslt:component prefix="my-ext" elements="timelapse" functions="getdate">
<lxslt:script lang="javascript">
<![CDATA[
function getdate(due_date)
{
var date = new Date(due_date);
var now = new Date();
var diff = now.getTime() - date.getTime();
var days = Math.floor(diff / (1000 * 60 * 60 * 24));
if (days < 7) {
var data = "Yes";
return data;
}
else if (days > 7) {
var data = "NO";
return data;
}
else if (days == 7) {
var data = "Perhaps";
return data;
}
else {
var data = "It's already done!";
return data;
}
}]]>
</lxslt:script>
</lxslt:component>
<xsl:template match="deadline">
<fo:block font-size="12pt" space-before.optimum="12pt"
text-align="center"
value-of="my-ext:getdate(string(@due_date))"></fo:block>
</xsl:template>
and my hello-page2-pdf.xml has this:
<page>
<title>XML nach HTML</title>
<content>
<para>Should you think if your are too late</para>
<deadline due_date="June 30, 2002"/>
</content>
</page>
transformation to pdf works well but i miss the part of the deadline-node in
the pdf.file
how can i get the data-string into the pdf
thanks a lot
gerald
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>