473,671 Members | 2,154 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 1750
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.c om 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
2121
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, but what I really want to know is am I OK placing php code inside a html line like this, or could there be problems?
0
1668
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 widget's window to produce a GdkWindow" I wrote this little program, which gets the XID of the Tkinter window and uses it to create a gtk.gdk.Window.
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 an ASPX page with a Header User Control and a Footer User Control. I'd like to put the transformed XML right in the middle. It seems like this is something that should be doable, but I can't quite figure it out. Is anyone out there doing this,...
4
3300
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 style sheet inside a <style> element in the SVG output document using a CDATA block. The CSS stylesheet is not an xml document, therefore I cannot open it using the document function (I suppose, I didn't even try frankly). In order to work...
1
3059
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
4490
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 that I've got confused. For example, what should be put into classid and codebase attributes of the OBJECT now embedding the EMBED tag?
1
1751
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 document I am transforming into this format using XSLT: <nDwarves>7</nDwarves>
0
1422
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" indent="yes"/> <xsl:template match="/"> <xsl:element name="Test">it works</xsl:element> </xsl:template>
7
9438
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 f() const; };
0
8914
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8820
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
8598
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,...
0
8670
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7433
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6223
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
4224
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
2810
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
2051
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.