473,512 Members | 14,457 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Embedding XML from XSL inside a template

Hello.

I'm relatively new to XSL but doing just fine, but I have a question
regarding <xsl:template name="foo"> elements:

I have something like this:

<xsl:template name="boxed-message">
<box type="rebound" method="smtp">
<default />
<reverse />
</box>
</xsl:template>

and I call it in other areas of code with:

<xsl:call-template name="boxed-message"></xsl:call-template>

Now, I can embed a simple string parameter using <xsl:with-param /> and
<xsl:param /> elements. How can I embed XML that *doesn't* come from
the XML document?

Example, one of the areas I have to use "boxed-message" requires a
fairly large segment of XML to be included betetween <default /> and
<reverse />.

I wanted to do something like...

<xsl:call-template name="boxed-message">
<delivery>
<tag-type>MD5</tag-type>
... the rest of my package here ...
</delivery>
</xsl:call-template>

but obviously that doesn't work.

Any tips?

Thanks,
Eric

Apr 25 '06 #1
5 1747
You can pass XML structure as a parameter, not just simple strings:

<xsl:call-template name="boxed-message">
<xsl:with-param name="parmname">
<delivery>
... etcetera ...
</delivery>
</xsl:with-param>
</xsl:call-template>

In the template, you define and use the paramater just as you did for a
string.
--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Apr 25 '06 #2
Joseph Kesselman wrote:
paramater


Oh, gods; I'm picking up my brother's typing habits... <sigh/><grin/>
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Apr 25 '06 #3
Excellent, thank you! The closest I could find in any of the example
websites out there was <!-- content --> inside the <xsl:with-param />
tag. Combined with <xsl:copy-of it's working wonders. I couldn't find a
single site that showed actual nodes inside it. Could have been my
search terms, though...

Thanks again for the quick reply!

Apr 26 '06 #4
ce*****@gmail.com wrote:
Hello.

I'm relatively new to XSL but doing just fine, [...] Now, I can embed a simple string parameter using <xsl:with-param /> and
<xsl:param /> elements. How can I embed XML that *doesn't* come from
the XML document?
Do you mean embed XML which comes from another external document?
(In which case use the document() function).
Example, one of the areas I have to use "boxed-message" requires a
fairly large segment of XML to be included betetween <default /> and
<reverse />.

I wanted to do something like...

<xsl:call-template name="boxed-message">
<delivery>
<tag-type>MD5</tag-type>
... the rest of my package here ...
</delivery>
</xsl:call-template>

but obviously that doesn't work.


Ah...do you mean you want the output of a call to boxed-message to
create a *different* element structure on different occasions?

What determines which kind of output you want?

If the different types of output can be classed, then use a parameter to
pass the class identity, and use xsl:when inside xsl:choose within the
template to instantiate the different outputs.

///Peter
--
XML FAQ: http://xml.silmaril.ie/
Apr 26 '06 #5
Joe Kesselman wrote:
Joseph Kesselman wrote:
paramater


Oh, gods; I'm picking up my brother's typing habits... <sigh/><grin/>


That's someone who stands in loco matris to you, presumably :-)

///Peter
Apr 26 '06 #6

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

Similar topics

10
2103
by: Ken Ward | last post by:
Hi All, I'm a new boy to php and working on a web site with long sections of code that could be done as includes apart from one or two things changing. I've tested the following and it works,...
0
1662
by: Sebastien Aubry | last post by:
Hello, I am trying to embed a Tkinter widget (TkZinc, http://www.tkzinc.org) inside a PyGtk HMI. A guru gave me this advice: "I think you can do some magic using the XID of the Tkinter...
5
611
by: Victor Fees | last post by:
I have an XML string in a database that I would like to display using XSLT. All of that works like a champ, but I can't figure out how to embed the XML inside an ASPX page. For example, I have...
4
3292
by: FC | last post by:
Hello folks, I was wondering if there any other method of achieving the following: I have a XSL transformation outputting a SVG document. For reasons too long to explain here, I must embed a CSS...
1
3055
by: Vital Lobachevsky | last post by:
Hi! I'm absolutely newbie with XSLT. Please, help me with this example. I have simple XML document like this: <skip /> <aaa> <link url="url1" /> <link url="url2" />
11
4464
by: Anna | last post by:
Hi all. I want to embed the EMBED tag in the object tag. I understood that I need to provide a PARAM tag inside the OBJECT whose value will hold the content of EMBED src attribute, but after...
1
1740
by: shaun roe | last post by:
I have an xml format for creating a database; lets say a fragment looks like this: <insertValue type="int">7</insert> <insertValue type="string">Hello everyone</insert> now I have a...
0
1409
by: hq4000 | last post by:
Given AStyleSheet.xsl : <AStyleSheet> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.mytest.mytest2.mytest3.com" version="1.0"> <xsl:output method="xml"...
7
9430
by: quarup | last post by:
I want to specialize a template function that lives inside a class, but am getting a compile error in VS.net 2003. Here's my code: template <class T> class A { public: template <class U> void...
0
7254
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,...
0
7373
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7432
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...
1
7094
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...
1
5079
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...
0
3230
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...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
452
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...

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.