469,596 Members | 2,260 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,596 developers. It's quick & easy.

xslt zero transformation?

Hi

I am a C# programmer writing a program which is to provide functions for
transforming a supplied xml document with a supplied xslt document, and
streaming the output to a supplied stream.

As I see it my job is really easy, as I am not responsible for the xml or
the xslt, and C#.net and other 3rd party libraries provide all sorts of help
for xml & xslt.

I know nothing about xslt, but I would like to begin testing some basic
functionality in my program. Is it possible, for example, to have an xslt
which "transforms" xml to the same xml? Then I can do a "zero
transformation" and just return the xml I received.

Thanks,
Peter
Apr 26 '06 #1
3 1410
Bo
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:xdt="http://www.w3.org/2005/xpath-datatypes">
<xsl:output method="xml" version="1.0" encoding="UTF-8"
indent="yes"/>
<xsl:template match="/">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>

Apr 26 '06 #2

"Bo" <Bo*********@gmail.com> skrev i en meddelelse
news:11**********************@e56g2000cwe.googlegr oups.com...
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:xdt="http://www.w3.org/2005/xpath-datatypes">
<xsl:output method="xml" version="1.0" encoding="UTF-8"
indent="yes"/>
<xsl:template match="/">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>


Fantastic, thanks.

Peter
Apr 26 '06 #3
The standard "Identity Transformation", from the XSLT 1.0 spec:

<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>
(This is also a standard starting point for constructing stylesheets, so
it's worth keeping around and/or memorizing.)

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Apr 26 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Sergio del Amo | last post: by
6 posts views Thread by Pete | last post: by
4 posts views Thread by Stephen | last post: by
5 posts views Thread by shauldar | last post: by
4 posts views Thread by simon.a.hulbert | last post: by
2 posts views Thread by Jonny B | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.