RE: Showing the name of the elements (user defined xml tag) in pd f using FOP

2003-05-22 Thread David Neary

 De : Zahidul Islam [mailto:[EMAIL PROTECTED]

 xsl:templates match=item_details
 xsl:apply-templates select=attributes/
 /xsl:templates
 xsl:templates match=attributes
 xsl:apply-templates/
 /xsl:templates

If you use 

  xsl:template match=attributes
xsl:for-each select=*
  xsl:value-of select=name()/
  xsl:text: /xsl:text
  xsl:apply-templates/
/xsl:for-each
  /xsl:template

that should work better.

Cheers,
Dave.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: XPath expression

2003-05-15 Thread David Neary

De : Torsten Erler [mailto:[EMAIL PROTECTED]
 I know it's not the right List, but I think there are a lot of XSL-Experts
here in this list. 

You might want to try the xsl-list at
http://www.mulberrytech.com/xsl/xsl-list

 Does anyone know the XPath expression for counting all Attributes and all
childs (grandchilds...)  of all preceding siblings of the selected node??? 

count(preceding-sibling::*/@* | preceding-sibling::*/*)
 
 In Other words which row number has the selected node in a full expanded
tree.
 (I need this to set the row backgound color for each second row)

I don't understand the relationship between question 1 and question 2...

For the second question, you just need something like this...

xsl:apply-templates select=row/

xsl:template match=row
  xsl:choose
xsl:when test=position() % 2 = 0
  !-- Even row --
/xsl:when
xsl:otherwise
  !-- odd row --
/xsl:otherwise
  /xsl:choose
/xsl:template

You should use the context nodeset to do the hard work for you - otherwise
you're going to enormously beef up your processing time.

By the way, please excuse the mail formatting if it's yucky - I haven't
quite figured out how to make Outlook behave properly.

Cheers,
Dave.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: XPath expression

2003-05-15 Thread David Neary

Hi,

 -position() doesn't work for me (it always returns '1' for 
 the first child
 of a node but i've to know the absolute position inside the 
 whole xml tree)

It only does this if the context nodeset is the set of siblings. You can
have the context node set be other stuff.

 -preceding-sibling::*/@* looks better i'll try it out

Well, that is for literal attributes, rather than child nodes (which is what
you seem to mean when you say attribute).

To clarify, name would be an attribute of node in this...
node name=doddery/

 I start with the root node (naturally), list all Attributes 
 of the current
 selected node by recursive call, then list all childs also by 
 recursive call
 and so on.

You can match all the nodes of the entire xml tree with //* - this means
that if your XML is like this...

root
  node
subnode/
subnode/
  /node
  node
subnode/
  /node
/root

then if you have a template (the [..] is to make sure that the root node
isn't matched by the template, which would result in an infinite loop)...

xsl:template match=/
  xsl:apply-templates select=//*[..]/
/xsl:template

xsl:template match=*
  xsl:textFor /xsl:text
  xsl:value-of select=name()/
  xsl:text the position is /xsl:text
  xsl:value-of select=position()/
  xsl:text
/xsl:text
/xsl:template

... your output will be

For root the position is 1
For node the position is 2
For subnode the position is 3
For subnode the position is 4
For node the position is 5
For subnode the position is 6

 psI've attached the xsl. If anyone has time to look in it
 ...any comments/proposals etc. are very welcome

Hope this helps. And if there are any follow-up questions, please look into
the xsl list at the URL I gave you earlier.

Cheers,
Dave.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Variable Template Name

2003-05-05 Thread David Neary

 De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 But i have a new problem.
 Does someone know a solution?

I have had the same problem, and I have solved it in a slightly different
way.

 Problem:
   
   xsl:variable name=templateNameobjectives/xsl:variable
 
   xsl:call-template name=$templateName/
 The variable templateName is a Value, wich is read from a XML.
 The $templateName in call-template does not dissolve.

Yup - this is because the argument to call-template is a QName, that is, the
name of a tag, rather than an XPath expression. 

In my problem, the solution was rather simple. I had something like this in
the xml...

root
  node mode=mode1
  node mode=mode2
  node mode=mode1
  node mode=mode3
  node mode=mode4
/root

And I ended up just doing this...

xsl:template match=/
  xsl:apply-templates select=root/node/
/xsl:template

xsl:template match=[EMAIL PROTECTED]'mode1']
  Mode 1
/xsl:template

xsl:template match=[EMAIL PROTECTED]'mode2']
  Mode 2
/xsl:template

xsl:template match=[EMAIL PROTECTED]'mode3']
  Mode 3
/xsl:template

xsl:template match=[EMAIL PROTECTED]'mode4']
  Mode 4
/xsl:template

I'm assuming that you can in some way modify your xml to use attributes
rather than parameters to get to the right template.


Hope this helps,
Dave.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Yet another block positioning question...

2003-04-28 Thread David Neary

Hi again,

I'm using a table to position a number of images, along with a caption, in a
grid.

I would like the images to be centered vertically and horizontally in the
table cell, and have the caption at the bottom of the table cell. The
equivalent old HTML looks like this...

table
  tr
td valign=center align=center width=400 height=400
  img src=myimg.jpeg alt=My image/
/td
  /tr
  tr
td style=text-align: center
  My Caption
/td
  /tr
/table

Again, I wanted to avoid complicating the Fo with tables inside tables, so I
figured there would be a way to have a block containing the image aligned
center (vertically and horizontally), and another block holding the caption
aligned with the bottom of the table cell. Is this the best approach to
take?

Cheers,
Dave.

--
David Neary
Phenix Engineering
110 ave Jean Jaures, 69007 Lyon 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: block-containers and absolute positioning

2003-04-25 Thread David Neary


De : J.Pietschmann [mailto:[EMAIL PROTECTED]
 David Neary wrote:
fo:block-container font-size=20pt text-align-last=center
  fo:block left=0pt top=0pt width=20mm height=20mm 
position=absolute
 
 Specifying position on fo:block has no effect in FOP, it only works on
 fo:block-container. You have to use two containers:

Thanks a lot - that works great, and has given bme a much better idea of
what's happening.

Dave Neary.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



block-containers and absolute positioning

2003-04-24 Thread David Neary
Hi,

I have a feeling this is probably very easy, but I have had 
some trouble doing it. I'm pretty hopeful that one of ye can 
point out the obvious mistake I'm making :)

I'm using fop 0.20.4 on Win32. I would like to lay out a 
letterhead type thing which looks something like this...

++
|| Name
|| Address 1
|  Logo  | Address 2
|| Phone
|| Fax
++


I think that this should be a block container with two blocks 
in it - one containing the external-graphic and one 
containing the rest of the letterhead (I guess I could do it 
with a table too). Then the right-hand block would contain 
one block each for each of the different data items in the letterhead.

So what I ended up with is 

fo:static-content flow-name=xsl-region-before
  fo:block-container font-size=20pt text-align-last=center
fo:block left=0pt top=0pt width=20mm height=20mm 
  position=absolute
fo:external-graphic width=20mm height=20mm 
  src=url(http://www.linux.ie/images/tux.gif)/
/fo:block
fo:block left=20mm top=0pt width=180mm 
  height=20mm position=absolute
  fo:blockTom Jones/fo:block
  fo:block17 Rugby Street/fo:block
  fo:blockCardiff CA12 14GC/fo:block
/fo:block
  /fo:block-container
/fo:static-content

The only problem is it doesn't work :) Either I put the two 
blocks in a block, and I get classic block behaviour (logo 
first, then text beneath) or I put them in a block-container, 
and noting gets displayed.

For information, in the page-master, the extent of the before 
is set to 4cm (for testing purposes).

Can anyone help me lay out the header?

Cheers, and thanks for the help,
Dave.

--
David Neary
Phenix Engineering
110 ave Jean Jaures, 69007 Lyon 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



border-top and -bottom on table-rows

2003-04-15 Thread David Neary

Hi,

I'm trying to figure out how to do a border between rows of a table, but the
borders are either not appearing or are being hidden by something else. What
is the expected behaviour of a border-top or -bottom? 

The fo is like this...

fo:table width=10cm table-layout=fixed
  fo:table-column column-width=5cm/
  fo:table-column column-width=5cm/
  fo:table-body
fo:table-row background-color=rgb(90%, 50%, 40%) border-top=solid
1px black 
  border-bottom=solid 1px black
  fo:table-cellfo:blockTest/fo:block/fo:table-cell
  fo:table-cellfo:blockTest/fo:block/fo:table-cell
/fo:table-row
  /fo:table-body
/fo:table

... and at least here there are no borders on the table row.

As a secondary question, when will percentages be supported in table (and
block) widths? At least in the version of fop that I'm using, there's no
support for it.

And finally (I promise) - is there a definitive document anywhere detailing
what bits of the xsl standard fop supports, and what bits it doesn't?

Cheers,
Dave.

--
David Neary
Phenix Engineering
110 ave Jean Jaures, 69007 Lyon 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]