473,785 Members | 2,185 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XSL: Parametrized copies of a common block


Take an XML source:

<document>
<recipient>
<name>John Doe</name>
<email>jo****** @example.invali d</email>
</recipient>
<recipient>
<name>Jane Doe</name>
<email>ja****** @example.invali d</email>
</recipient>
<body>
<title>Hello <recipient-name/>,</title>
<section>
Some text...
</section>
<section>
<b>Bolded text...</b>
</section>
</body>
</document>

Now it should be quite clear that I want to create multiple copies of
the body parametrized with the values in the recipient. As the body
can be quite complex, it can't be done with a single xslt template.
The question is, how to make those references to the recipient
element?

I have few ideas:

1) Only one XSLT stylesheet: in top level match the recipients and
from there pass enough information further to get the data for the
references.

Problem with this: need to pass the parameters for multiple levels of
templates. This makes the stylesheet quite ugly.

2) Restructure the document with one stylesheet and then do the actual
transformation with another.

Problem with this: two stylesheets.

3) Find a way to handle the references in the result.

Problem with this: Do the result formats have a way to do references?

Background:

I need to be able to generate several formats: pdf, html and text (max
80 chars in a line). Currently I do the pdf with XSL-FO and the others
via HTML. The most important formats are the pdf and the text. I
translate the XSL-FO to pdf with fop.

I tried to express the original problem here. I am able to do at least
solutions 1) and 2), but those are both quite ugly and I really would
like to have a beautiful solution.

--
Ilpo Nyyssönen # biny # /* :-) */
Jul 20 '05 #1
1 1308
in******@iki.fi (Ilpo Nyyssönen) writes:
1) Only one XSLT stylesheet: in top level match the recipients and
from there pass enough information further to get the data for the
references.

Problem with this: need to pass the parameters for multiple levels of
templates. This makes the stylesheet quite ugly.


Ok, XSLT 2.0 tunnel parameters solve this and I get those with saxon
and it even works.

Thanks for the help. ;-)

--
Ilpo Nyyssönen # biny # /* :-) */
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2266
by: Adelard | last post by:
Here is my xsl and xml, I want the xml node: LABEL3 ( General Information ) to move under the ROW when viewing or printing this PDF Document. How can I do it? Thanks
0
1587
by: Chris Huebsch | last post by:
Hello, I have a Real-World-XSLT-Problem.(tm) That is: A XML-Document of about 75.000 elements contains <person>-elements at various depths of the tree. Each person consists of a <name>, <vorname> and <titel>. There are about 8000 persons in this tree. A lot of them exist more than once. (That means that there are person-Elements with the same content.)
3
3045
by: Tjerk Wolterink | last post by:
Hello i have xml code like this: <page:page xmlns:page="namespacefor page"> <page:section> <page:header> <b>Hello</b>There </page:header> <page:content> --- HTML CODE like: <i>Y</i>es i like bla bal <center>bla</center><img> alblalba
0
3952
by: Rary | last post by:
I am using XSL:FO to generate PDF report for my XML, generating it in tables, i want that tables should completely be at one place, if there is a page break , all the contents of the table should move to the next page. can any one suggest a way out? This is my code (number 18, Brunelli Rocco, should move to the next page): XML: <?xml version="1.0" encoding="windows-1252"?>
0
2432
by: Nathan | last post by:
Hi, I seem to having a peculiar problem with the display of odd and even pages in XSL-FO. Here is a small background of the problem. My xsl stylesheet mentions my fo:layout-master-set as <fo:layout-master-set> <fo:simple-page-master margin-left="0.5in" margin-right="0.5in" page-width="8.5in" margin-bottom="0.5in" master-name="Section-odd-page" margin-top="0.5in" page-height="14in"> <fo:region-after region-name="xsl-region-after-odd"
5
4416
by: shauldar | last post by:
Is there a way (tool, hack...) to create an XSL:FO from an XSLT + XML files? My motivation is that we want to use a tool to design reports, and from that "design" generate both HTML (via XSLT) and PDF (via XSL:FO). The only tool we have seen is Altova's StyleVision, which is very unfriendly (and uses a proprietary representation, SPS, from which it generates the various XSLs). We have considered instead using InfoPath, which is WYSIWYG,...
5
1353
by: Analizer1 | last post by:
Hello again... Im using XMl/xsl to generate text report from a service getting data to xml from sqlserver 2005 xml generates ok but when xslCompiledTransform runs i get a StackoverflowException i have 11,000 rows of data going through....is this just too much for Xsl
0
1480
by: zamba | last post by:
hi im new with xsl and i have to process a xsl with a lot of xml (about 50.000) the transform is slow ..and i want to optimize my xsl . here is the example so if anybody could give some advices to me i will appreciatte : <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:fox="http://xml.apache.org/fop/extensions" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"...
1
5326
by: cleary1981 | last post by:
Hi, I am trying to add page numbers to my document in xsl fo. I can get the page numbers to work but I need them to show at the bottom of each page. I know you can define an area as region-after but don't know how. Heres my xsl file so far. <?xml version="1.0" encoding="ISO-8859-1" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" ...
0
9646
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9484
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10157
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10097
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7505
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5386
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2887
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.