473,320 Members | 1,946 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.

An XSLT that does nothing

Hi,

What would be minimilistic XSLT that does "nothing" (no
transformation) to the given XML content.

Thank you.

Sarah Haff
Jul 20 '05 #1
4 6414


Sarah Haff wrote:
What would be minimilistic XSLT that does "nothing" (no
transformation) to the given XML content.


An empty template for the document root node should do nothing

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/" />

</xsl:stylesheet>

in the sense that it outputs nothing.

If doing nothing means copying the source document unchanged then you
need the identity transformation, see
http://www.w3.org/TR/xslt#copying
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2
Hi Martin,
An empty template for the document root node should do nothing
<xsl:stylesheet version="1.0"
......
in the sense that it outputs nothing. This wasn't what I was looking for. I should have been more clear in
my original question ;)
If doing nothing means copying the source document unchanged then you
need the identity transformation, see This IS what I am looking for. :)

http://www.w3.org/TR/xslt#copying

Is this the best (minilistic) was of doing this ? :-/

Thank you.
Sarah
Jul 20 '05 #3
sa********@hotmail.com (Sarah Haff) writes:
If doing nothing means copying the source document unchanged then you
need the identity transformation, see

This IS what I am looking for. :)

http://www.w3.org/TR/xslt#copying

Is this the best (minilistic) was of doing this ? :-/


This is pretty small too:

<xsl:template match="/">
<xsl:copy-of select="."/>
</xsl:template>

Which is minimal is moot.

Ben

--
Ben Edgington
Mail to the address above is discarded.
Mail to ben at that address might be read.
http://www.edginet.org/
Jul 20 '05 #4


Sarah Haff wrote:

If doing nothing means copying the source document unchanged then you
need the identity transformation, see


This IS what I am looking for. :)
http://www.w3.org/TR/xslt#copying


Is this the best (minilistic) was of doing this ? :-/


Not quite, rather it is a good start if you want to copy most of the XML
but want to change some nodes, then you can usually start with that
identity transformation and add templates for those nodes that you want
to change.
If really copying is all you need then the template Ben has posted is
more minimalistic as it simply copies the document node with all child
nodes.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #5

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

Similar topics

5
by: K. N. | last post by:
Is there any good and fast Python module for XSLT processing ? I'm going to use XML and XSLT to generate web pages, so I need XSLT processor that will be able to transform for example a DOM object...
9
by: Jeff Rubard | last post by:
I am curious to know whether anyone has experience using XSLT for web XML (non-XHTML) styling, either with CSS or standalone. I myself have engaged in rather unsuccessful experiments with the...
5
by: Fred | last post by:
Not much expertise on XSLT and trying to understand it's uses when creating apps in VS.NET? If I wanted flexibility on the UI (View aspect of M.V.C.): - How does it compare with creating...
1
by: Wil | last post by:
I'm very new to developing in .NET and even newer to XML. The past few days have been pretty frustrating for me because I'm trying to perform a transform on data in a dataset and it's not working....
3
by: Jack Fox | last post by:
I've never had the need to work with XML, but I believe I now have an appropriate application. I have time-series data in objects organized as a tree that I want an ASP.NET program to write out to...
4
by: Moogy | last post by:
I'm pulling my hair out here. First, I'm new to XML, so that doesn't help, but none of this makes any sense to me. All I'm trying to do is take a simple source XML file and translate it with an...
0
by: Christopher M. Lauer | last post by:
I have done my best to answer this question but can not find the proper set of commands. I would like to transform an xml file (in code behind) and display its output in a specific html tag,...
7
by: One Handed Man \( OHM - Terry Burns \) | last post by:
I've been battling with this stupid problem for hours now. WebApp: Trying to do a simple transformation using XSLT to a Web Page, but it just failes without an error message ( In other words,...
0
by: Terry Brown | last post by:
I have an xml file: <?xml version="1.0" encoding="utf-8" ?> <G2Registers xmlns="http://tempuri.org/registers.xsd"> <register> <name>Version Register</name> <address>"00000000"</address>...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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: 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: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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....

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.