473,664 Members | 3,001 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XSLT question related to <xsl:template > and <xsl:apply-templates>

Hi

wonder if anybody can clear by doubt
XML file :

<score id="1">
<film>A Little Princess</film>
<composer>Patri ck Doyle</composer>
<year>1995</year>
<grade>
<mygrade>100</mygrade>
<vijay>50</vijay>
</grade>
</score>
XSL file 1 :

<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="score">
<xsl:apply-templates />
</xsl:template>
</xsl:stylesheet>

Output 1 :

<?xml version="1.0" encoding="utf-8"?>
A Little Princess
Patrick Doyle
1995

100
50

XSL file 2 :

<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="grade">
<xsl:apply-templates />
</xsl:template>
</xsl:stylesheet>

Output 2:

<?xml version="1.0" encoding="utf-8"?>
A Little Princess
Patrick Doyle
1995

100
50
Question is why does the ouptput 2 showed top three lines, when I only
matched "grade".

Regards
Vijay
Jul 20 '05 #1
1 1425


Vijay singh wrote:
XML file :

<score id="1">
<film>A Little Princess</film>
<composer>Patri ck Doyle</composer>
<year>1995</year>
<grade>
<mygrade>100</mygrade>
<vijay>50</vijay>
</grade>
</score> XSL file 2 :

<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="grade">
<xsl:apply-templates />
</xsl:template>
</xsl:stylesheet>

Output 2:

<?xml version="1.0" encoding="utf-8"?>
A Little Princess
Patrick Doyle
1995

100
50
Question is why does the ouptput 2 showed top three lines, when I only
matched "grade".


There are built-in templates to recursively process the document and to
output text nodes, see
http://www.w3.org/TR/xslt#built-in-rule

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #2

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

Similar topics

4
3721
by: Invalidlastname | last post by:
Hi, I have an XML document, created from ADO DataSet, which contains XML data in some nodes shown below: <NewDataSet> <Table> <field_name>My Selection</field_name> <field_type>dropdown</field_type> <field_choice_text>
5
3507
by: Amelyan | last post by:
How can I get state of dynamically created controls (RadioButton, CheckBox, TextBox.Text) on post back when I click submit button? The only way I know is by traversing Response.Form enumberator; Response.Form.GetEnumerator(), etc. while, identifying specific controls by programmatically assigned unique id (e.g. MyButton_AnswerID_123). However, I am not sure if that is the proper way. What is the common practice?
6
24307
by: tentstitcher | last post by:
Hi all: I have a source xml document with an element of type string. This element contains something like the following: <stringData> &lt;Header&gt; &lt;Body&gt; </stringData> I would like to apply an XSLT and replace all occurances of &lt; with < and &gt; with >.
1
1752
by: the_dog_gabby | last post by:
Hello, I have a stylesheet that contains C# functions to generate XML. When I apply the stylesheet to my document, everything works perfectly except the data I get back is escaped like so: &lt;test&gt;this is a test&lt;/test&gt; I need to get <test>this is a test</testrather than the escaped data. Any input would be appreciated.
1
1542
by: andrew_nuss | last post by:
Hi, Something mysterious has happened to my stylus studio project as I've added changes to the XSL file that renders html output. Before, the output included the <HEADand <BODYtags for the HTML output, even though I did nothing explictly to cause this. Now, they are missing in the HTML output. Is this a project setting in stylus studio, or is it an artifact of the various apply-template commands in the XSL file? Or something else. ...
0
8437
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
8348
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
8778
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...
0
8636
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
5660
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4185
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...
0
4351
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2003
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1759
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.