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 Chandrasekhar Sanku <ch...@wipro.com> on 2005/02/21 10:28:42 UTC
first and last pages timings...
Hi,
In the pdf generation process, I found that first and last pages are
taking much time than the others.
What is the reason?
Thanks & Regards,
Chandu
Confidentiality Notice
The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or Mailadmin@wipro.com immediately
and destroy all copies of this message and any attachments.
Re: XSLT Question
Posted by Kai Hackemesser <ka...@gmx.net>.
Hi, Jay, hi, all,
I'm currently close to a solution I was thinking of. but currently I don't
understand following:
This is the beginning of my new call template. As branch I support a list of
nodes for the tree's next level. As tree-structure-string I support the list
of currently needed images (in form of a string) before this tree branch. in
the for-each I decide for each element if it is the last one or not, needed
for finding the image to be added in this tree level and for the next level.
So far for now, but when I tried to debug the XSL Transformation I found
that $tree-structure-new-branch is not set to a value. In my case it took
the xsl:otherwise route, but value isn't set. What did I wrong?
Regards,
Kai
<xsl:template name="tree-master">
<xsl:param name="branch"/>
<xsl:param name="tree-structure-string"/>
<xsl:for-each select="$branch">
<xsl:variable name="tree-structure-new-branch">
<xsl:choose>
<!-- if this node is not last... -->
<xsl:when test="not(position()=last())">
<img width="16" height="16"
alt="the branch is not finished"/>
</xsl:when>
<xsl:otherwise>
<img width="16" height="16" alt="This is the last element
of the branch"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
> Hi, Jay,
>
> I try your solution tomorrow to see how it looks like. If I found a better
> solution I will tell you here :-)
>
> But many thanks for your hints!
>
> Kai
>
>
> > Hi, Kai,
> >
> > The following stylesheet, applied to the following XML (an extension of
> > your example), generates the same tree view as used by the Acrobat
> Reader
> > (at least in version 7):
> >
> > XSL:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <xsl:stylesheet version="1.0"
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> > >
> >
> > <xsl:template match="objects">
> > <html>
> > <head>
> > <title>Test</title>
> > </head>
> > <style>
> > <!--
> > td {font-family:monospace}
> > -->
> > </style>
> > <body>
> > <table>
> > <xsl:apply-templates/>
> > </table>
> > </body>
> > </html>
> > </xsl:template>
> >
> > <xsl:template match="object">
> > <tr>
> > <td>
> > <xsl:for-each select="ancestor::object[not(position()=last())]">
> > <xsl:choose>
> > <xsl:when test="generate-id(.)=generate-id(../*[last()])">
> >   
> > </xsl:when>
> > <xsl:otherwise>
> > | 
> > </xsl:otherwise>
> > </xsl:choose>
> > </xsl:for-each>
> > <xsl:choose>
> > <xsl:when test="generate-id(.)=generate-id(../*[last()])">
> > <xsl:if test="..[not(name()='objects')]"> -</xsl:if>
> > <xsl:value-of select="@id"/>
> > </xsl:when>
> > <xsl:otherwise>
> > |-<xsl:value-of select="@id"/>
> > </xsl:otherwise>
> > </xsl:choose>
> > <xsl:apply-templates/>
> > </td>
> > </tr>
> > </xsl:template>
> >
> > <xsl:template match="relation">
> > <xsl:apply-templates/>
> > </xsl:template>
> >
> > </xsl:stylesheet>
> >
> > XML:
> > <objects>
> > <object Level="0" id="01">
> > <relation Level="0">
> > <object Level="1" id="11">
> > <relation Level="1">
> > <object Level="2" id="21">
> > <relation Level="2">
> > <object Level="3" id="31"/>
> > <object Level="3" id="32"/>
> > </relation>
> > </object>
> > <object Level="2" id="22">
> > <relation Level="2">
> > <object Level="3" id="33">
> > <relation Level="3">
> > <object Level="4" id="41"/>
> > <object Level="4" id="42"/>
> > </relation>
> > </object>
> > <object Level="3" id="34">
> > <relation Level="3">
> > <object Level="4" id="43"/>
> > <object Level="4" id="44"/>
> > </relation>
> > </object>
> > </relation>
> > </object>
> > <object Level="2" id="23">
> > <relation level="2">
> > <object Level="3" id="35"/>
> > <object Level="3" id="36"/>
> > </relation>
> > </object>
> > </relation>
> > </object>
> > </relation>
> > </object>
> > </objects>
> >
> > Note that the relation elements and Level attributes are unnecessary. If
> > you have control over the application that generates the XML, you could
> > eliminate them. In that case you could alse eliminate the
> match="relation"
> > template in the XSL.
> >
> > If you want a line down the left-most edge, I'll have to leave that to
> > you. I have run out of the time that I can spend on someone else's
> > project. I did enjoy having something different to work on, though.
> >
> > Thanks.
> >
> > Jay Bryant
> > Bryant Communication Services
> > (presently consulting at Synergistic Solution Technologies)
> >
> >
> >
> >
> > "Kai Hackemesser" <ka...@gmx.net>
> > 02/21/2005 11:45 AM
> > Please respond to
> > fop-user@xml.apache.org
> >
> >
> > To
> > fop-user@xml.apache.org
> > cc
> >
> > Subject
> > Re: XSLT Question
> >
> >
> >
> >
> >
> >
> > Hi J,
> >
> > Partly you are right, with your test I can tell what image I need for
> the
> > current level of the tree, but I can't see how to retrieve the required
> > images from lower levels. the test you described needs to be done for
> > every
> > element up to level 0. It's not just the Indent which I want to show,
> but
> > also some lines and branches, depending from the structure. Like the
> > folder
> > tree in an windows explorer window.
> >
> > Ciao!
> > Kai
> >
> > > Hi, Kai,
> > >
> > > I don't think you need to call a template for that. You can test for
> the
> >
> > > characteristics of the node from within the matching template and get
> > the
> > > image you need.
> > >
> > > Several xsl:when statements within an xsl:choose block should let you
> > > figure out which images to use when. For example, <xsl:when
> > > test="generate-id(.)=generate-id(../*[last()])"> will tell you whether
> > the
> > > current node is the last child node of its parent. Also, to indent
> > > properly, you can read the Level attribute and put the appropriate
> > number
> > > of indentation objects (blank table cells, spaces, whatever you use)
> > > before the image.
> > >
> > > J
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: fop-user-help@xml.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
Re: XSLT Question
Posted by Kai Hackemesser <ka...@gmx.net>.
Hi, Jay,
I try your solution tomorrow to see how it looks like. If I found a better
solution I will tell you here :-)
But many thanks for your hints!
Kai
> Hi, Kai,
>
> The following stylesheet, applied to the following XML (an extension of
> your example), generates the same tree view as used by the Acrobat Reader
> (at least in version 7):
>
> XSL:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> >
>
> <xsl:template match="objects">
> <html>
> <head>
> <title>Test</title>
> </head>
> <style>
> <!--
> td {font-family:monospace}
> -->
> </style>
> <body>
> <table>
> <xsl:apply-templates/>
> </table>
> </body>
> </html>
> </xsl:template>
>
> <xsl:template match="object">
> <tr>
> <td>
> <xsl:for-each select="ancestor::object[not(position()=last())]">
> <xsl:choose>
> <xsl:when test="generate-id(.)=generate-id(../*[last()])">
>   
> </xsl:when>
> <xsl:otherwise>
> | 
> </xsl:otherwise>
> </xsl:choose>
> </xsl:for-each>
> <xsl:choose>
> <xsl:when test="generate-id(.)=generate-id(../*[last()])">
> <xsl:if test="..[not(name()='objects')]"> -</xsl:if>
> <xsl:value-of select="@id"/>
> </xsl:when>
> <xsl:otherwise>
> |-<xsl:value-of select="@id"/>
> </xsl:otherwise>
> </xsl:choose>
> <xsl:apply-templates/>
> </td>
> </tr>
> </xsl:template>
>
> <xsl:template match="relation">
> <xsl:apply-templates/>
> </xsl:template>
>
> </xsl:stylesheet>
>
> XML:
> <objects>
> <object Level="0" id="01">
> <relation Level="0">
> <object Level="1" id="11">
> <relation Level="1">
> <object Level="2" id="21">
> <relation Level="2">
> <object Level="3" id="31"/>
> <object Level="3" id="32"/>
> </relation>
> </object>
> <object Level="2" id="22">
> <relation Level="2">
> <object Level="3" id="33">
> <relation Level="3">
> <object Level="4" id="41"/>
> <object Level="4" id="42"/>
> </relation>
> </object>
> <object Level="3" id="34">
> <relation Level="3">
> <object Level="4" id="43"/>
> <object Level="4" id="44"/>
> </relation>
> </object>
> </relation>
> </object>
> <object Level="2" id="23">
> <relation level="2">
> <object Level="3" id="35"/>
> <object Level="3" id="36"/>
> </relation>
> </object>
> </relation>
> </object>
> </relation>
> </object>
> </objects>
>
> Note that the relation elements and Level attributes are unnecessary. If
> you have control over the application that generates the XML, you could
> eliminate them. In that case you could alse eliminate the match="relation"
> template in the XSL.
>
> If you want a line down the left-most edge, I'll have to leave that to
> you. I have run out of the time that I can spend on someone else's
> project. I did enjoy having something different to work on, though.
>
> Thanks.
>
> Jay Bryant
> Bryant Communication Services
> (presently consulting at Synergistic Solution Technologies)
>
>
>
>
> "Kai Hackemesser" <ka...@gmx.net>
> 02/21/2005 11:45 AM
> Please respond to
> fop-user@xml.apache.org
>
>
> To
> fop-user@xml.apache.org
> cc
>
> Subject
> Re: XSLT Question
>
>
>
>
>
>
> Hi J,
>
> Partly you are right, with your test I can tell what image I need for the
> current level of the tree, but I can't see how to retrieve the required
> images from lower levels. the test you described needs to be done for
> every
> element up to level 0. It's not just the Indent which I want to show, but
> also some lines and branches, depending from the structure. Like the
> folder
> tree in an windows explorer window.
>
> Ciao!
> Kai
>
> > Hi, Kai,
> >
> > I don't think you need to call a template for that. You can test for the
>
> > characteristics of the node from within the matching template and get
> the
> > image you need.
> >
> > Several xsl:when statements within an xsl:choose block should let you
> > figure out which images to use when. For example, <xsl:when
> > test="generate-id(.)=generate-id(../*[last()])"> will tell you whether
> the
> > current node is the last child node of its parent. Also, to indent
> > properly, you can read the Level attribute and put the appropriate
> number
> > of indentation objects (blank table cells, spaces, whatever you use)
> > before the image.
> >
> > J
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
Re: XSLT Question
Posted by JB...@s-s-t.com.
Hi, Kai,
The following stylesheet, applied to the following XML (an extension of
your example), generates the same tree view as used by the Acrobat Reader
(at least in version 7):
XSL:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:template match="objects">
<html>
<head>
<title>Test</title>
</head>
<style>
<!--
td {font-family:monospace}
-->
</style>
<body>
<table>
<xsl:apply-templates/>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="object">
<tr>
<td>
<xsl:for-each select="ancestor::object[not(position()=last())]">
<xsl:choose>
<xsl:when test="generate-id(.)=generate-id(../*[last()])">
  
</xsl:when>
<xsl:otherwise>
| 
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:choose>
<xsl:when test="generate-id(.)=generate-id(../*[last()])">
<xsl:if test="..[not(name()='objects')]"> -</xsl:if>
<xsl:value-of select="@id"/>
</xsl:when>
<xsl:otherwise>
|-<xsl:value-of select="@id"/>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates/>
</td>
</tr>
</xsl:template>
<xsl:template match="relation">
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
XML:
<objects>
<object Level="0" id="01">
<relation Level="0">
<object Level="1" id="11">
<relation Level="1">
<object Level="2" id="21">
<relation Level="2">
<object Level="3" id="31"/>
<object Level="3" id="32"/>
</relation>
</object>
<object Level="2" id="22">
<relation Level="2">
<object Level="3" id="33">
<relation Level="3">
<object Level="4" id="41"/>
<object Level="4" id="42"/>
</relation>
</object>
<object Level="3" id="34">
<relation Level="3">
<object Level="4" id="43"/>
<object Level="4" id="44"/>
</relation>
</object>
</relation>
</object>
<object Level="2" id="23">
<relation level="2">
<object Level="3" id="35"/>
<object Level="3" id="36"/>
</relation>
</object>
</relation>
</object>
</relation>
</object>
</objects>
Note that the relation elements and Level attributes are unnecessary. If
you have control over the application that generates the XML, you could
eliminate them. In that case you could alse eliminate the match="relation"
template in the XSL.
If you want a line down the left-most edge, I'll have to leave that to
you. I have run out of the time that I can spend on someone else's
project. I did enjoy having something different to work on, though.
Thanks.
Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)
"Kai Hackemesser" <ka...@gmx.net>
02/21/2005 11:45 AM
Please respond to
fop-user@xml.apache.org
To
fop-user@xml.apache.org
cc
Subject
Re: XSLT Question
Hi J,
Partly you are right, with your test I can tell what image I need for the
current level of the tree, but I can't see how to retrieve the required
images from lower levels. the test you described needs to be done for
every
element up to level 0. It's not just the Indent which I want to show, but
also some lines and branches, depending from the structure. Like the
folder
tree in an windows explorer window.
Ciao!
Kai
> Hi, Kai,
>
> I don't think you need to call a template for that. You can test for the
> characteristics of the node from within the matching template and get
the
> image you need.
>
> Several xsl:when statements within an xsl:choose block should let you
> figure out which images to use when. For example, <xsl:when
> test="generate-id(.)=generate-id(../*[last()])"> will tell you whether
the
> current node is the last child node of its parent. Also, to indent
> properly, you can read the Level attribute and put the appropriate
number
> of indentation objects (blank table cells, spaces, whatever you use)
> before the image.
>
> J
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
Re: XSLT Question
Posted by JB...@s-s-t.com.
Hi, Kai,
Well, perhaps the solution I just sent will be good enough. Maybe you can
say, "That's how Adobe does it," and get away with it...
If not, that left-most line will require a recursive template.
Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies).
"Kai Hackemesser" <ka...@gmx.net>
02/21/2005 02:12 PM
Please respond to
fop-user@xml.apache.org
To
fop-user@xml.apache.org
cc
Subject
Re: XSLT Question
Hi, Jay,
The first example is the perfect hit:
> Key:
> |-A node that is not the last node at its level
> -A node that is the last node at its level
> | Continuation of an ancestor level
>
> Root
> |-Dir1
> | |-File11
> | -File12
> |-Dir2
> | |-File21
> | |-File22
> | |-Dir21
> | | |-File211
> | | -File212
> | -Dir22
> | -File221
> -Dir3
> In the first case, you need either a for-each or a recursive template to
> generate all the "continuation" images and space them properly.
Thats what I'm searching a solution for ...
> From a user-interface design point of view, by the way, the second view
> is much better. The first is very cluttered. All those lines draw the
> eye away from the information that matters without adding any value. If
> you must do the first, you should make the lines NOT stand out (light
> grey and thin lines would do).
Customer wishes *sigh*
> By the way, the Windows XP Explorer just has boxes with + and - signs.
> It has no lines at all, relying purely on indentation to show the
> relation between levels. In my view, that's one of the things Microsoft
> did right.
You are right! I maybe had another tool in mind, TreeSize or such.
Ciao!
Kai
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
Re: XSLT Question
Posted by Kai Hackemesser <ka...@gmx.net>.
Hi, Jay,
The first example is the perfect hit:
> Key:
> |-A node that is not the last node at its level
> -A node that is the last node at its level
> | Continuation of an ancestor level
>
> Root
> |-Dir1
> | |-File11
> | -File12
> |-Dir2
> | |-File21
> | |-File22
> | |-Dir21
> | | |-File211
> | | -File212
> | -Dir22
> | -File221
> -Dir3
> In the first case, you need either a for-each or a recursive template to
> generate all the "continuation" images and space them properly.
Thats what I'm searching a solution for ...
> From a user-interface design point of view, by the way, the second view
> is much better. The first is very cluttered. All those lines draw the
> eye away from the information that matters without adding any value. If
> you must do the first, you should make the lines NOT stand out (light
> grey and thin lines would do).
Customer wishes *sigh*
> By the way, the Windows XP Explorer just has boxes with + and - signs.
> It has no lines at all, relying purely on indentation to show the
> relation between levels. In my view, that's one of the things Microsoft
> did right.
You are right! I maybe had another tool in mind, TreeSize or such.
Ciao!
Kai
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
Re: XSLT Question
Posted by JB...@s-s-t.com.
Hi, Kai,
Here are two layouts of a file structure. (To appear correctly, they need
to be viewed with a monospace font.) Since I don't like to send images to
mailing lists, I have used text symbols as shown below:
Key:
|-A node that is not the last node at its level
-A node that is the last node at its level
| Continuation of an ancestor level
Root
|-Dir1
| |-File11
| -File12
|-Dir2
| |-File21
| |-File22
| |-Dir21
| | |-File211
| | -File212
| -Dir22
| -File221
-Dir3
Root
|-Dir1
|-File11
-File12
|-Dir2
|-File21
|-File22
|-Dir21
|-File211
-File212
-Dir22
-File221
-Dir3
Which one are you after? Or have I not grasped the problem?
In the first case, you need either a for-each or a recursive template to
generate all the "continuation" images and space them properly. In the
second, you don't, because you can just multiply the level by the indent
amount per level. (If you are writing to HTML rather than PDF, you could
use a for-each to generate the right number of nbsp characters or empty
table cells or whatever.)
>From a user-interface design point of view, by the way, the second view is
much better. The first is very cluttered. All those lines draw the eye
away from the information that matters without adding any value. If you
must do the first, you should make the lines NOT stand out (light grey and
thin lines would do).
By the way, the Windows XP Explorer just has boxes with + and - signs. It
has no lines at all, relying purely on indentation to show the relation
between levels. In my view, that's one of the things Microsoft did right.
Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)
"Kai Hackemesser" <ka...@gmx.net>
02/21/2005 11:45 AM
Please respond to
fop-user@xml.apache.org
To
fop-user@xml.apache.org
cc
Subject
Re: XSLT Question
Hi J,
Partly you are right, with your test I can tell what image I need for the
current level of the tree, but I can't see how to retrieve the required
images from lower levels. the test you described needs to be done for
every
element up to level 0. It's not just the Indent which I want to show, but
also some lines and branches, depending from the structure. Like the
folder
tree in an windows explorer window.
Ciao!
Kai
> Hi, Kai,
>
> I don't think you need to call a template for that. You can test for the
> characteristics of the node from within the matching template and get
the
> image you need.
>
> Several xsl:when statements within an xsl:choose block should let you
> figure out which images to use when. For example, <xsl:when
> test="generate-id(.)=generate-id(../*[last()])"> will tell you whether
the
> current node is the last child node of its parent. Also, to indent
> properly, you can read the Level attribute and put the appropriate
number
> of indentation objects (blank table cells, spaces, whatever you use)
> before the image.
>
> J
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
Re: XSLT Question
Posted by Kai Hackemesser <ka...@gmx.net>.
Hi J,
Partly you are right, with your test I can tell what image I need for the
current level of the tree, but I can't see how to retrieve the required
images from lower levels. the test you described needs to be done for every
element up to level 0. It's not just the Indent which I want to show, but
also some lines and branches, depending from the structure. Like the folder
tree in an windows explorer window.
Ciao!
Kai
> Hi, Kai,
>
> I don't think you need to call a template for that. You can test for the
> characteristics of the node from within the matching template and get the
> image you need.
>
> Several xsl:when statements within an xsl:choose block should let you
> figure out which images to use when. For example, <xsl:when
> test="generate-id(.)=generate-id(../*[last()])"> will tell you whether the
> current node is the last child node of its parent. Also, to indent
> properly, you can read the Level attribute and put the appropriate number
> of indentation objects (blank table cells, spaces, whatever you use)
> before the image.
>
> J
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
Re: XSLT Question
Posted by JB...@s-s-t.com.
Hi, Kai,
I don't think you need to call a template for that. You can test for the
characteristics of the node from within the matching template and get the
image you need.
Several xsl:when statements within an xsl:choose block should let you
figure out which images to use when. For example, <xsl:when
test="generate-id(.)=generate-id(../*[last()])"> will tell you whether the
current node is the last child node of its parent. Also, to indent
properly, you can read the Level attribute and put the appropriate number
of indentation objects (blank table cells, spaces, whatever you use)
before the image.
J
"Kai Hackemesser" <ka...@gmx.net>
02/21/2005 10:55 AM
Please respond to
fop-user@xml.apache.org
To
fop-user@xml.apache.org
cc
Subject
Re: XSLT Question
Hi, Jay,
ok, here more details:
my XML source looks like that:
...
<object Level="0">
<relation Level="0">
<object Level="1">
<relation Level="1">
<object Level="2">
...
</object>
</relation>
</object>
<object Level="1">
<relation Level="1">
<object Level="2">
...
I think you got the structure. There are <attribute> elements and a lot of
element attributes I now haven't shown because not needed for my question.
I have to create a explorer tree like picture from that. For each line of
my
list I need to find out what tree structure images are needed (&u2503;
&u2523; &u2517; in form of fixed size gif images), I need to know for
example if this element is the last child of its parent, if the parent is
the last child of its parent and so on, to decide which image is the
correct.
I need it recursive because there is theoretical no limit of depth,
practical it would lie at about ten.
My solution was about this:
<xsl:template match="object">
<tr>
<td>
<xsl:call-template name="tree-scructure">
<xsl:with-param name="treenode" select="node()"/>
</xsl:call-template>
<xsl:value-of
select="attribute[@name='DisplayedName']/value"/>
</td>
<td>
<xsl:call-template name="replace-null">
<xsl:with-param name="input"
select="attribute[@name='beGTABeschreibPos']/value"/>
</xsl:call-template>
</td>
<td>
<xsl:value-of select="attribute
[@name='LifeCycleState']/value"/>
</td>
<td>
<xsl:value-of select="attribute[@name='ProjectName']/value"/>
</td>
</tr>
<xsl:apply-templates select="relation"/>
</xsl:template>
<xsl:template match="relation">
<tr>
<td>
<xsl:call-template name="tree-scructure">
<xsl:with-param name="treenode" select="node()"/>
</xsl:call-template>
<xsl:value-of
select="attribute[@name='LDisplayedName']/value"/>
</td>
</tr>
<xsl:apply-templates select="object"/>
</xsl:template>
<xsl:template name="tree-scructure">
<xsl:param name="treenode"/>
<xsl:param name="recursive"/>
<xsl:if test="$treenode/@Level > 0">
<xsl:call-template name="tree-scructure">
<xsl:with-param name="treenode" select="parent::node()"/>
<xsl:with-param name="recursive">true</xsl:with-param>
</xsl:call-template>
</xsl:if>
<img width="16" height="16" alt="just an incomplete test"/>
</xsl:template>
That's where I am now.... a not working thing.
Thank you for your time,
Kai
> Hi, Kai,
>
> I would need a bit more detail to be able to help with that. Please post
> the smallest (but still still complete) set of XML files (input and
> desired output) that you want. That way, we can see what you mean.
>
> A couple observations, though: You can't walk back up the tree from a
> parameter passed to a template by using path expressions. Thus, you
can't
> get the parent of a node you passed as a parameter by using .. or a
> similar construct. If memory serves, this problem arises because, when
you
> pass a path as a parameter, you really pass a result tree fragment.
> Unfortunately, the result tree fragment has its own root node (the node
> you passed), so you can't go up from there. To solve this problem, you
> need more information. In the past, I have used a text representation of
> the full path (from the document root) to the node I want. Then I can
use
> the name() function and predicate logic to walk back up the path. If you
> only need to go up one level, you could pass the parent node as another
> parameter. That method is not extensible, but it will work, so long as
you
> really only need to go up one level.
>
> Also, you should subscribe to xsl-list@lists.mulberrytech.com and ask
that
> question there. The heavy hitters in the XSL world read that list.
>
> HTH
>
> Jay Bryant
> Bryant Communication Services
> (presently consulting at Synergistic Solution Technologies)
>
>
>
>
> "Kai Hackemesser" <ka...@gmx.net>
> 02/21/2005 09:27 AM
> Please respond to
> fop-user@xml.apache.org
>
>
> To
> fop-user@xml.apache.org
> cc
>
> Subject
> XSLT Question
>
>
>
>
>
>
> Hello,
>
> I know this is not quite the right mailing list for that question, but
> maybe
> somebody here knows?
>
> I need to create a kind of recursive call-template, where certain
> attributes
> >from different parent elements are needed. I want to do a call to a
> template
> by itself, giving it the parent element as parameter. Ho can I evaluate
> the
> parent of a parameter given node? Or how do I set a parent element to be
> current() element? While in a call?
>
> Regards,
> Kai
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: fop-user-help@xml.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: fop-user-help@xml.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
Re: XSLT Question
Posted by Kai Hackemesser <ka...@gmx.net>.
Hi, Jay,
ok, here more details:
my XML source looks like that:
...
<object Level="0">
<relation Level="0">
<object Level="1">
<relation Level="1">
<object Level="2">
...
</object>
</relation>
</object>
<object Level="1">
<relation Level="1">
<object Level="2">
...
I think you got the structure. There are <attribute> elements and a lot of
element attributes I now haven't shown because not needed for my question.
I have to create a explorer tree like picture from that. For each line of my
list I need to find out what tree structure images are needed (&u2503;
&u2523; &u2517; in form of fixed size gif images), I need to know for
example if this element is the last child of its parent, if the parent is
the last child of its parent and so on, to decide which image is the
correct.
I need it recursive because there is theoretical no limit of depth,
practical it would lie at about ten.
My solution was about this:
<xsl:template match="object">
<tr>
<td>
<xsl:call-template name="tree-scructure">
<xsl:with-param name="treenode" select="node()"/>
</xsl:call-template>
<xsl:value-of select="attribute[@name='DisplayedName']/value"/>
</td>
<td>
<xsl:call-template name="replace-null">
<xsl:with-param name="input"
select="attribute[@name='beGTABeschreibPos']/value"/>
</xsl:call-template>
</td>
<td>
<xsl:value-of select="attribute
[@name='LifeCycleState']/value"/>
</td>
<td>
<xsl:value-of select="attribute[@name='ProjectName']/value"/>
</td>
</tr>
<xsl:apply-templates select="relation"/>
</xsl:template>
<xsl:template match="relation">
<tr>
<td>
<xsl:call-template name="tree-scructure">
<xsl:with-param name="treenode" select="node()"/>
</xsl:call-template>
<xsl:value-of select="attribute[@name='LDisplayedName']/value"/>
</td>
</tr>
<xsl:apply-templates select="object"/>
</xsl:template>
<xsl:template name="tree-scructure">
<xsl:param name="treenode"/>
<xsl:param name="recursive"/>
<xsl:if test="$treenode/@Level > 0">
<xsl:call-template name="tree-scructure">
<xsl:with-param name="treenode" select="parent::node()"/>
<xsl:with-param name="recursive">true</xsl:with-param>
</xsl:call-template>
</xsl:if>
<img width="16" height="16" alt="just an incomplete test"/>
</xsl:template>
That's where I am now.... a not working thing.
Thank you for your time,
Kai
> Hi, Kai,
>
> I would need a bit more detail to be able to help with that. Please post
> the smallest (but still still complete) set of XML files (input and
> desired output) that you want. That way, we can see what you mean.
>
> A couple observations, though: You can't walk back up the tree from a
> parameter passed to a template by using path expressions. Thus, you can't
> get the parent of a node you passed as a parameter by using .. or a
> similar construct. If memory serves, this problem arises because, when you
> pass a path as a parameter, you really pass a result tree fragment.
> Unfortunately, the result tree fragment has its own root node (the node
> you passed), so you can't go up from there. To solve this problem, you
> need more information. In the past, I have used a text representation of
> the full path (from the document root) to the node I want. Then I can use
> the name() function and predicate logic to walk back up the path. If you
> only need to go up one level, you could pass the parent node as another
> parameter. That method is not extensible, but it will work, so long as you
> really only need to go up one level.
>
> Also, you should subscribe to xsl-list@lists.mulberrytech.com and ask that
> question there. The heavy hitters in the XSL world read that list.
>
> HTH
>
> Jay Bryant
> Bryant Communication Services
> (presently consulting at Synergistic Solution Technologies)
>
>
>
>
> "Kai Hackemesser" <ka...@gmx.net>
> 02/21/2005 09:27 AM
> Please respond to
> fop-user@xml.apache.org
>
>
> To
> fop-user@xml.apache.org
> cc
>
> Subject
> XSLT Question
>
>
>
>
>
>
> Hello,
>
> I know this is not quite the right mailing list for that question, but
> maybe
> somebody here knows?
>
> I need to create a kind of recursive call-template, where certain
> attributes
> >from different parent elements are needed. I want to do a call to a
> template
> by itself, giving it the parent element as parameter. Ho can I evaluate
> the
> parent of a parameter given node? Or how do I set a parent element to be
> current() element? While in a call?
>
> Regards,
> Kai
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: fop-user-help@xml.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: fop-user-help@xml.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
Re: XSLT Question
Posted by JB...@s-s-t.com.
Hi, Kai,
I would need a bit more detail to be able to help with that. Please post
the smallest (but still still complete) set of XML files (input and
desired output) that you want. That way, we can see what you mean.
A couple observations, though: You can't walk back up the tree from a
parameter passed to a template by using path expressions. Thus, you can't
get the parent of a node you passed as a parameter by using .. or a
similar construct. If memory serves, this problem arises because, when you
pass a path as a parameter, you really pass a result tree fragment.
Unfortunately, the result tree fragment has its own root node (the node
you passed), so you can't go up from there. To solve this problem, you
need more information. In the past, I have used a text representation of
the full path (from the document root) to the node I want. Then I can use
the name() function and predicate logic to walk back up the path. If you
only need to go up one level, you could pass the parent node as another
parameter. That method is not extensible, but it will work, so long as you
really only need to go up one level.
Also, you should subscribe to xsl-list@lists.mulberrytech.com and ask that
question there. The heavy hitters in the XSL world read that list.
HTH
Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)
"Kai Hackemesser" <ka...@gmx.net>
02/21/2005 09:27 AM
Please respond to
fop-user@xml.apache.org
To
fop-user@xml.apache.org
cc
Subject
XSLT Question
Hello,
I know this is not quite the right mailing list for that question, but
maybe
somebody here knows?
I need to create a kind of recursive call-template, where certain
attributes
from different parent elements are needed. I want to do a call to a
template
by itself, giving it the parent element as parameter. Ho can I evaluate
the
parent of a parameter given node? Or how do I set a parent element to be
current() element? While in a call?
Regards,
Kai
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
XSLT Question
Posted by Kai Hackemesser <ka...@gmx.net>.
Hello,
I know this is not quite the right mailing list for that question, but maybe
somebody here knows?
I need to create a kind of recursive call-template, where certain attributes
from different parent elements are needed. I want to do a call to a template
by itself, giving it the parent element as parameter. Ho can I evaluate the
parent of a parameter given node? Or how do I set a parent element to be
current() element? While in a call?
Regards,
Kai
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org