Here's an interesting problem that hit my inbox this morning that had me scratching my head for a while. I need to create the following output:
| Employee: | Ted Higgins |
| Jon Swanson | |
| Ivor Problem | |
| Helen Back |
easy I hear you say, but heres the catch - no tables allowed!
Ahhh ... you have me ... well at least for a while. BIP has a little know feature that allows you to show data inline, 'for-each@inlines:XXXXX', the user guide goes some way to explain, the best way to find out whats going on is to experiment. Just using the @inlines command I got
Employee: Ted Higgins Jon Swanson Ivor Problem ||
Helen Back
Assuming the || is the edge of the page. Using:
Employee: <?for-each@inlines:G_EMP?><?NAME?><?end for-each?>
So the next step was to start looking at MSWords indenting capabilities and just how far BIP goes in supporting them :o) So I highlighted the whole line above, right click -> paragraph and on the resulting dialog selected a hanging indent, set it it to 1in to get things sitting under the word Employee correctly. But after generating the output I was left with:
Employee: Ted Higgins Jon Swanson Ivor Problem ||
Helen Back
Almost there but no cigar! I needed to have a carriage return after each name. After a little fiddling and googling ... for 'xslfo inserting new line characters' ... which yielded very little .. I tried adding an fo:block after each name et voila it worked. Not very scientific maybe but thats how things are discovered much of the time. Now I have the list as I wanted ... Im sure there are other ways to acheive the same result and if you find them please share. Sample files here ...
Comments (6)
Hi Santosh
Sorry the formatting did not come out on your comment ... can you elaborate ?
Tim
Posted by Tim Dexter | March 6, 2007 9:24 AM
Posted on March 6, 2007 09:24
Hi Santhosh
Sorry, Im being stupid here. You originally said:
I have a requirement where I need to print employee two times in one line. Like below
Ted Higgins Jan Swanson Ivor Problem Helen Black .... ....
But they only appear once in your example, do you need:
Ted Higgins Jan Swanson Ivor Problem Helen Black Ted Higgins Jan Swanson Ivor Problem Helen Black
or
Ted Higgins Ted Higgins Jan Swanson Jan Swanson Ivor Problem Ivor Problem Helen Black Helen Black ?
or have I missed the point completely ?
Posted by Tim Dexter | March 6, 2007 10:13 AM
Posted on March 6, 2007 10:13
I have a requirement where I need to print employee two times in one line. Like below
Ted Higgins Jan Swanson
Ivor Problem Helen Black
.... ....
How is this possible? I cant break the page into columns because this is only for one section of the report.
Thanks
Posted by santosh | March 6, 2007 11:04 AM
Posted on March 6, 2007 11:04
like below
[code]
Ted Higgins Jan Swanson
Ivor Problem Helen Black
.... ....
[/code]
Posted by santosh | March 6, 2007 11:28 AM
Posted on March 6, 2007 11:28
How would you take this and then only grab the names for say, the 'Shipping' department? I am going off of the xml in the zip file I downloaded from the link above. Would you use something like the code below, or is there some other way to handle something like this using the inlines function?
<?if:DEPT='Shipping'?> {current code from example above} <?end if?>
Thanks,
Andy Waldrop
andy.waldrop@kniferiver.com
Posted by Andy Waldrop | September 22, 2009 1:56 PM
Posted on September 22, 2009 13:56
Andy
Rather than use an if statement you can use an XPATH expression which is more efficient
The part in the square braces is telling the rendering engine to go up a couple of levels in the tree (../../) and then check that the current DEPT='Shipping'.
cheers
tim
Posted by Tim | September 22, 2009 2:03 PM
Posted on September 22, 2009 14:03