473,320 Members | 1,865 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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>Patrick Doyle</composer>
<year>1995</year>
<grade>
<mygrade>100</mygrade>
<vijay>50</vijay>
</grade>
</score>
XSL file 1 :

<xsl:stylesheet 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:stylesheet 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 1399


Vijay singh wrote:
XML file :

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

<xsl:stylesheet 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
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>...
5
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;...
6
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...
1
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: ...
1
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.