473,811 Members | 2,843 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamically add XML tags to be processed?

Hi, I am trying to create a sort of include file into my xsl files such
that calling the following template will push these xml tags into my
document such that the other xsl files can use these tags to make
decisions. In this case I want antother template that is going to
create tables be able to call this template in order to get information
for the various table paramaters and then use xsl:attribute to push
items into the table tag. Does anyone know if there is a way to
dynamically create xml tags using xsl in the document such that the
rest of the xsl style sheet processing can use these tags? Below is
the template file I am looking to create ... and further below is it's
usuage.

<!-- please note this is experimental -->
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">

<!-- import the data output template for displaying each row of resutls
-->

<!-- table settings -->
<!-- border="0" cellpadding="2" cellspacing="0" bgcolor="lightb lue"
width="50%"-->
<xsl:template name="summary_t able_specs">
<xml_summary_ta ble cellpadding='2'/>
<xml_summary_ta ble cellspacing='6'/>
<xml_summary_ta ble border='3'/>
<xml_summary_ta ble width='100%'/>
<xml_summary_ta ble bgcolor='lightb lue'/>
</xsl:template>
</xsl:stylesheet>

......... usage below

<xsl:import="su mmary_table.xsl ">
<xsl:call-template name="summary_t able_specs"/>
<table>
<xsl:attribut e href="cellpaddi ng">
<xsl:value-of select="/xml_summary_tab le[@cellpadding][text()]"/>
</xsl:attribute>

.....

Jul 20 '05 #1
1 1559
"bjam" <bs****@yahoo.c om> writes:
Hi, I am trying to create a sort of include file into my xsl files such
that calling the following template will push these xml tags into my
document
It's hard to follow what you mean here. XSLT doesn't have any access to
tags in the source files, it just has access to a node tree generated by
an XML parser which has processed (and discarded) the tags.
such that the other xsl files can use these tags to make
decisions. In this case I want antother template that is going to
create tables be able to call this template in order to get information
for the various table paramaters and then use xsl:attribute to push
items into the table tag. Does anyone know if there is a way to
dynamically create xml tags using xsl in the document such that the
rest of the xsl style sheet processing can use these tags? Below is
the template file I am looking to create ... and further below is it's
usuage.
<!-- please note this is experimental -->
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">

<!-- import the data output template for displaying each row of resutls
-->

<!-- table settings -->
<!-- border="0" cellpadding="2" cellspacing="0" bgcolor="lightb lue"
width="50%"-->
<xsl:template name="summary_t able_specs">
<xml_summary_ta ble cellpadding='2'/>
<xml_summary_ta ble cellspacing='6'/>
<xml_summary_ta ble border='3'/>
<xml_summary_ta ble width='100%'/>
<xml_summary_ta ble bgcolor='lightb lue'/>
</xsl:template>
</xsl:stylesheet>

........ usage below

<xsl:import="su mmary_table.xsl ">
<xsl:call-template name="summary_t able_specs"/>
<table>
<xsl:attribut e href="cellpaddi ng">
<xsl:value-of select="/xml_summary_tab le[@cellpadding][text()]"/>
</xsl:attribute>

....

Looking at the example then perhaps what you want to do is put the
following in to a file table.xml alongside your stylesheet
<foo>
<summary_tabl e cellpadding='2'/>
<summary_tabl e cellspacing='6'/>
<summary_tabl e border='3'/>
<summary_tabl e width='100%'/>
<summary_tabl e bgcolor='lightb lue'/>
</foo>
Note that you shouldn't (or with some parsers can not) use an element
name xml_summary_tab le as all names starting with xml (or XML) are
reserved.

Then you can do

<table>
<xsl:copy-of select="documen t('table.xml')/summary_table/@cellpadding"/>
Or depending what you want to do, perhaps you don't want this lookup
table at all and want to use an attribute set
http://www.w3.org/TR/xslt#attribute-sets

David
Jul 20 '05 #2

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

Similar topics

3
3356
by: Adam | last post by:
Hi All, Is it possible to use includes dynamically in html. Hopefully the following example will give an idea what I am rying to do. Thanks in advance Adam <script language="javascript">
7
2046
by: | last post by:
What is the beat way to dynamically write/add to the HEAD tag of an ASPX page (the <head runat=server ... is too error prone and not very repeatable)? Thanks.
4
1824
by: Stu | last post by:
Hi, I am writing a content management system that has to have W3C compliant output. The pages are template driven and there are special strings within the template to be used as placeholders for the content. However, when I output the content to a literal (as shown below) the body and html tags are within the form tags. Is there any way to position the form tags within the dynamically generated text (ie to just after the opening body...
6
47689
by: mayurkoul2002 | last post by:
hello there..... i have a problem here...........i want to assign ID attribute dynamically to the html tags......and i need a function for tht....can anybody help me out in tht
4
2716
by: assgar | last post by:
Hi I am stuck on a problem. I use 3 scripts(form, function and process). Development on win2003 server. Final server will be linux Apache,Mysql and PHP is being used. The form displays multiple dynamic rows with chechboxs, input box for units of service, description of the service and each row has its own dropdown list of unit fees that apply.
1
7497
by: vega80 | last post by:
Hi. I have a problem with assigning an onkeypress-function to dynamically created input-boxes.I want to put the content of an input-field into a tag-list when the user hits enter. This works fine the first time (when the input-field is created in a non-dynamical way). The next input-field is created dynamically by a function that is called when the user hits enter (the previously generated input-field will be hidden). Then I'm trying...
2
2271
by: Andy | last post by:
Hi, I have an ASP.NET webpage that contains an ASP.NET XML control. This control accepts an XSLT stylesheet and XML document which it then uses to render HTML code where the XML control is positioned for the client at the server. This setup works great for an XSLT stylesheet that generates plain HTML tags. But, this doesn't work so well if I use ASP.NET tags (such as <asp:dropdownlist>) inside the stylesheet. Although the code for the...
0
1097
by: =?Utf-8?B?SlA=?= | last post by:
I’m working on a C# ASP application in which they want to give the users the ability to pic their color themes. Each theme has its own folder and the images for each theme are named the same So that in theory, all I need to do is dynamically change the scr tags of all the non server side images to be the name of the folder. Ex: <image scr=’/images//leftcorner.jpg’/> I’ve been pondering the best solution to make this work and I...
0
9726
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
10647
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
10384
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
10395
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
7667
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
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4338
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
3865
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3017
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.