You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Simone <si...@xerox.com> on 2012/03/21 22:58:15 UTC

FOP 1.0 - TLE values based on XML values

Hi, all. I am new to FOP.
I am successfully creating AFP files but now I am facing a problem with TLE 
values.

It seems I can only set fixed values for TLE. I mean:
<afp:tag-logical-element name="User" value="John Doe"/>.

What I'd like to have is something like this:
<afp:tag-logical-element name="User" value="@User>

Is there someway to have this done? regards,

Simone


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: FOP 1.0 - TLE values based on XML values

Posted by Simone <si...@xerox.com>.
Great! It worked!!!
I had to set it this way <afp:tag-logical-element name="Job" 
value="{Job/@Job}"/>


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: FOP 1.0 - TLE values based on XML values

Posted by Pascal Sancho <pa...@takoma.fr>.
Hi,

This thread is related to issue #52969 (see [1]).

Please, discussing this issue on both places is not a good practice; 
doing-it first on this list is a good start, then if a bug is revealed, 
you can ask on buglist.

That said, I guess you set the value "@User" directly in your XSLT.
If this is the case, This will give you "@User" in resulting XSL-FO.

To get the value of User attribute, you need to use an <xsl-value-of> 
element, or its short tag {}:
<afp:tag-logical-element name="User" value="{@User}"/>

If this is not the case, please give a short XSL-FO (not XSLT) that 
demonstrates the issue, and explain what you expect and what you get.

[1] https://issues.apache.org/bugzilla/show_bug.cgi?id=52969

Le 22/03/2012 14:00, Simone a écrit :
> Alexios Giotis<alex.giotis<at>  gmail.com>  writes:
>
>>
>> Hi Simone,
>>
>> What you are writing below is not XSLT, it is XSL:FO. One usage of XSLT is
> to create an XSL:FO based on the XML
>> data that you have. And this should be exactly what you need. The links
> written by Peter are a good starting
>> point.
>>
>> Alexios Giotis
>>
>> On Mar 22, 2012, at 1:17 PM, Simone wrote:
>>
>>> Hi, Peter. Thanks for your reply.
>>> I am already applyng an XSLT transformation using FOP and its Tag Logical
>>> Element (TLE) Extension.
>>> As in http://xmlgraphics.apache.org/fop/1.0/output.html#afp-tag-logical-
>>> element, I declared the appropriate namespace in the fo:root element like
> this:
>>>
>>>       <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
>>>                xmlns:afp="http://xmlgraphics.apache.org/fop/extensions/afp">
>>>
>>> then set in XSLT something like
>>>
>>> <fo:page-sequence master-reference="simple">
>>>         <afp:tag-logical-element name="foo" value="bar"/>
>>>         <fo:flow flow-name="xsl-region-body">
>>>
>>> and it works.
>>>
>>> The problem is that I have to create dynamic TLE values based on XML data
> and
>>> was looking for a suggestion to accomplish this since anything I tried did
> not
>>> work.
>>
>
>
> It is exacly what I am doing.
> I use Altova StyleVision to create an XSLT-FO.
> When I have the XSLT-FO, I add the appropriate namespace to use FOP/AFP/TLE
> extension.
> In FOP, then, I pass XML and XSLT-FO to print directly, create a PDF, a FO or
> (in this case) an AFP.
> I still thank you and Peter for links posted but I can't still find the way to
> set in XSLT-FO the code tho have TLE values based on XML data. I am stuck at
> this point.

-- 
Pascal

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: FOP 1.0 - TLE values based on XML values

Posted by Simone <si...@xerox.com>.
Alexios Giotis <alex.giotis <at> gmail.com> writes:

> 
> Hi Simone,
> 
> What you are writing below is not XSLT, it is XSL:FO. One usage of XSLT is 
to create an XSL:FO based on the XML
> data that you have. And this should be exactly what you need. The links 
written by Peter are a good starting
> point. 
> 
> Alexios Giotis
> 
> On Mar 22, 2012, at 1:17 PM, Simone wrote:
> 
> > Hi, Peter. Thanks for your reply.
> > I am already applyng an XSLT transformation using FOP and its Tag Logical 
> > Element (TLE) Extension.
> > As in http://xmlgraphics.apache.org/fop/1.0/output.html#afp-tag-logical-
> > element, I declared the appropriate namespace in the fo:root element like 
this:
> > 
> >      <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
> >               xmlns:afp="http://xmlgraphics.apache.org/fop/extensions/afp">
> > 
> > then set in XSLT something like
> > 
> > <fo:page-sequence master-reference="simple">
> >        <afp:tag-logical-element name="foo" value="bar"/>
> >        <fo:flow flow-name="xsl-region-body">
> > 
> > and it works.
> > 
> > The problem is that I have to create dynamic TLE values based on XML data 
and 
> > was looking for a suggestion to accomplish this since anything I tried did 
not 
> > work.
> 


It is exacly what I am doing.
I use Altova StyleVision to create an XSLT-FO.
When I have the XSLT-FO, I add the appropriate namespace to use FOP/AFP/TLE 
extension.
In FOP, then, I pass XML and XSLT-FO to print directly, create a PDF, a FO or 
(in this case) an AFP.
I still thank you and Peter for links posted but I can't still find the way to 
set in XSLT-FO the code tho have TLE values based on XML data. I am stuck at 
this point.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


RE: FOP 1.0 - TLE values based on XML values

Posted by Thomas Morrison <Th...@microfocus.com>.
> Great! It worked!!!
> I had to set it this way <afp:tag-logical-element name="Job" 
>    value="{Job/@Job}"/>

For the record, this is strictly an XSLT/XPath thing.  Using the braces
{} in this manner is called an "attribute value template".  This
instructs the XSLT processor to interpret the value of an attribute as
an XPath expression rather than simply a literal.

Tom Morrison
Micro Focus
This message has been scanned by MailController - portal1.mailcontroller.co.uk
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: FOP 1.0 - TLE values based on XML values

Posted by Simone <si...@xerox.com>.
Thomas Morrison <Thomas.Morrison <at> microfocus.com> writes:

> 
> Instead of:
> <afp:tag-logical-element name="Job" value="@Job"/>
> 
> Try this:
> <afp:tag-logical-element name="Job" value="{@Job}"/>
> 
> Tom Morrison
> Senior Manager, Systems Software Projects
> Micro Focus
> 
> This message has been scanned by MailController - 
portal1.mailcontroller.co.uk


Great! It worked!!!
I had to set it this way <afp:tag-logical-element name="Job" 
value="{Job/@Job}"/>


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


RE: FOP 1.0 - TLE values based on XML values

Posted by Thomas Morrison <Th...@microfocus.com>.
Instead of:
<afp:tag-logical-element name="Job" value="@Job"/>

Try this:
<afp:tag-logical-element name="Job" value="{@Job}"/>

Tom Morrison
Senior Manager, Systems Software Projects
Micro Focus

This message has been scanned by MailController - portal1.mailcontroller.co.uk
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: FOP 1.0 - TLE values based on XML values

Posted by Simone <si...@xerox.com>.
Alexios Giotis <alex.giotis <at> gmail.com> writes:

> 
> Hi Simone,
> 
> What you are writing below is not XSLT, it is XSL:FO. One usage of XSLT is 
to create an XSL:FO based on the XML
> data that you have. And this should be exactly what you need. The links 
written by Peter are a good starting
> point. 
> 
> Alexios Giotis
> 
> On Mar 22, 2012, at 1:17 PM, Simone wrote:
> 
> > Hi, Peter. Thanks for your reply.
> > I am already applyng an XSLT transformation using FOP and its Tag Logical 
> > Element (TLE) Extension.
> > As in http://xmlgraphics.apache.org/fop/1.0/output.html#afp-tag-logical-
> > element, I declared the appropriate namespace in the fo:root element like 
this:
> > 
> >      <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
> >               xmlns:afp="http://xmlgraphics.apache.org/fop/extensions/afp">
> > 
> > then set in XSLT something like
> > 
> > <fo:page-sequence master-reference="simple">
> >        <afp:tag-logical-element name="foo" value="bar"/>
> >        <fo:flow flow-name="xsl-region-body">
> > 
> > and it works.
> > 
> > The problem is that I have to create dynamic TLE values based on XML data 
and 
> > was looking for a suggestion to accomplish this since anything I tried did 
not 
> > work.
> 
As Pascal Sancho advised me, to better understand here is the starting snippet 
from my XSLT-FO until <afp:tag-logical-element name="Job" value="@Job"/>.
If anyone interested in, I can sent the entire XSLT-FO and an example of XML 
to transform. Regards.

<?xml version="1.0" encoding="utf-8"?>
<!--Designed and generated by Altova StyleVision Enterprise Edition 2012 rel. 
2 - see http://www.altova.com/stylevision for more information.-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:altova="http://www.altova.com" 
xmlns:altovaext="http://www.altova.com/xslt-extensions" 
xmlns:clitype="clitype" xmlns:fn="http://www.w3.org/2005/xpath-functions" 
xmlns:iso4217="http://www.xbrl.org/2003/iso4217" 
xmlns:ix="http://www.xbrl.org/2008/inlineXBRL" xmlns:java="java" 
xmlns:link="http://www.xbrl.org/2003/linkbase" 
xmlns:sps="http://www.altova.com/StyleVision/user-xpath-functions" 
xmlns:xbrldi="http://xbrl.org/2006/xbrldi" 
xmlns:xbrli="http://www.xbrl.org/2003/instance" 
xmlns:xlink="http://www.w3.org/1999/xlink" 
xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:fo="http://www.w3.org/1999/XSL/Format" 
xmlns:svg="http://www.w3.org/2000/svg" 
xmlns:afp="http://xmlgraphics.apache.org/fop/extensions/afp" exclude-result-
prefixes="altova altovaext clitype fn iso4217 ix java link sps xbrldi xbrli 
xlink xs xsi">
  <xsl:output version="1.0" method="xml" encoding="UTF-8" indent="no" />
  <xsl:param name="SV_OutputFormat" select="'PDF'" />
  <xsl:variable name="XML" select="/" />
  <xsl:variable name="fo:layout-master-set">
    <fo:layout-master-set>
      <fo:simple-page-master master-name="page-master-185618136-even" margin-
left="10mm" margin-right="10mm" page-height="297mm" page-width="210mm" margin-
top="10mm" margin-bottom="10mm">
        <fo:region-body margin-top="0mm" margin-bottom="0mm" column-count="1" 
column-gap="10mm" />
      </fo:simple-page-master>
      <fo:simple-page-master master-name="page-master-185618136-odd" margin-
left="10mm" margin-right="10mm" page-height="297mm" page-width="210mm" margin-
top="10mm" margin-bottom="10mm">
        <fo:region-body margin-top="0mm" margin-bottom="0mm" column-count="1" 
column-gap="10mm" />
      </fo:simple-page-master>
      <fo:page-sequence-master master-name="page-master-185618136">
        <fo:repeatable-page-master-alternatives>
          <fo:conditional-page-master-reference master-reference="page-master-
185618136-even" odd-or-even="even" />
          <fo:conditional-page-master-reference master-reference="page-master-
185618136-odd" odd-or-even="odd" />
        </fo:repeatable-page-master-alternatives>
      </fo:page-sequence-master>
    </fo:layout-master-set>
  </xsl:variable>
  <xsl:variable name="altova:nPxPerIn" select="96" />
  <xsl:template match="/">
    <fo:root>
      <xsl:copy-of select="$fo:layout-master-set" />
      <fo:declarations>
        <x:xmpmeta xmlns:x="adobe:ns:meta/">
          <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
            <rdf:Description rdf:about="" 
xmlns:dc="http://purl.org/dc/elements/1.1/">
              <dc:title>
                <xsl:value-of select="Job/@Job" />
              </dc:title>
              <dc:creator>
                <xsl:value-of select="Job/@Customer" />
              </dc:creator>
              <dc:description>
                <xsl:value-of select="Job/@Batch" />
              </dc:description>
            </rdf:Description>
            <rdf:Description rdf:about="" 
xmlns:pdf="http://ns.adobe.com/pdf/1.3/">
              <pdf:Keywords>
                <xsl:value-of select="Job/@InsertingKit" />
              </pdf:Keywords>
            </rdf:Description>
            <rdf:Description rdf:about="" 
xmlns:xmp="http://ns.adobe.com/xap/1.0/">
              <xmp:CreatorTool>Altova StyleVision Enterprise Edition 2012 rel. 
2 (http://www.altova.com)</xmp:CreatorTool>
            </rdf:Description>
          </rdf:RDF>
        </x:xmpmeta>
      </fo:declarations>
      <fo:page-sequence force-page-count="no-force" master-reference="page-
master-185618136" initial-page-number="auto" format="1">
      <afp:tag-logical-element name="Job" value="@Job"/>


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: FOP 1.0 - TLE values based on XML values

Posted by Alexios Giotis <al...@gmail.com>.
Hi Simone,

What you are writing below is not XSLT, it is XSL:FO. One usage of XSLT is to create an XSL:FO based on the XML data that you have. And this should be exactly what you need. The links written by Peter are a good starting point. 

Alexios Giotis



On Mar 22, 2012, at 1:17 PM, Simone wrote:

> Hi, Peter. Thanks for your reply.
> I am already applyng an XSLT transformation using FOP and its Tag Logical 
> Element (TLE) Extension.
> As in http://xmlgraphics.apache.org/fop/1.0/output.html#afp-tag-logical-
> element, I declared the appropriate namespace in the fo:root element like this:
> 
>      <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
>               xmlns:afp="http://xmlgraphics.apache.org/fop/extensions/afp">
> 
> then set in XSLT something like
> 
> <fo:page-sequence master-reference="simple">
>        <afp:tag-logical-element name="foo" value="bar"/>
>        <fo:flow flow-name="xsl-region-body">
> 
> and it works.
> 
> The problem is that I have to create dynamic TLE values based on XML data and 
> was looking for a suggestion to accomplish this since anything I tried did not 
> work.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: FOP 1.0 - TLE values based on XML values

Posted by Simone <si...@xerox.com>.
Peter Hancock <peter.hancock <at> gmail.com> writes:

> 
> Hi Simone,
> 
> Have you considered applying an XSLT transform to the fo document, or
> during any process you may have that generates the fo?  An explanation
> of the steps required to achieve this are outside of the scope of this
> mailing list:  If you are new to XSLT, try taking a look at [1] and
> browsing [2].
> 
> Good luck!
> 
> Peter
> 
> [1] http://www.w3schools.com/xsl/
> [2] http://www.mulberrytech.com/xsl/xsl-list/
> 
> On Wed, Mar 21, 2012 at 9:58 PM, Simone <simone.ranucci <at> xerox.com> 
wrote:
> > Hi, all. I am new to FOP.
> > I am successfully creating AFP files but now I am facing a problem with TLE
> > values.
> >
> > It seems I can only set fixed values for TLE. I mean:
> > <afp:tag-logical-element name="User" value="John Doe"/>.
> >
> > What I'd like to have is something like this:
> > <afp:tag-logical-element name="User" value="@User>
> >
> > Is there someway to have this done? regards,
> >
> > Simone
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: fop-users-unsubscribe <at> xmlgraphics.apache.org
> > For additional commands, e-mail: fop-users-help <at> xmlgraphics.apache.org
> >
> 


Hi, Peter. Thanks for your reply.
I am already applyng an XSLT transformation using FOP and its Tag Logical 
Element (TLE) Extension.
As in http://xmlgraphics.apache.org/fop/1.0/output.html#afp-tag-logical-
element, I declared the appropriate namespace in the fo:root element like this:

      <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
               xmlns:afp="http://xmlgraphics.apache.org/fop/extensions/afp">

then set in XSLT something like

<fo:page-sequence master-reference="simple">
        <afp:tag-logical-element name="foo" value="bar"/>
        <fo:flow flow-name="xsl-region-body">

and it works.

The problem is that I have to create dynamic TLE values based on XML data and 
was looking for a suggestion to accomplish this since anything I tried did not 
work.

Regards.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: FOP 1.0 - TLE values based on XML values

Posted by Peter Hancock <pe...@gmail.com>.
Hi Simone,

Have you considered applying an XSLT transform to the fo document, or
during any process you may have that generates the fo?  An explanation
of the steps required to achieve this are outside of the scope of this
mailing list:  If you are new to XSLT, try taking a look at [1] and
browsing [2].

Good luck!

Peter

[1] http://www.w3schools.com/xsl/
[2] http://www.mulberrytech.com/xsl/xsl-list/


On Wed, Mar 21, 2012 at 9:58 PM, Simone <si...@xerox.com> wrote:
> Hi, all. I am new to FOP.
> I am successfully creating AFP files but now I am facing a problem with TLE
> values.
>
> It seems I can only set fixed values for TLE. I mean:
> <afp:tag-logical-element name="User" value="John Doe"/>.
>
> What I'd like to have is something like this:
> <afp:tag-logical-element name="User" value="@User>
>
> Is there someway to have this done? regards,
>
> Simone
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org