Start with an identity transform. This will copy everything (elements, attributes, text, comments, processing-instructions) as-is.
Add more specific templates to override processing by the identity transform or the built-in template rules.
Example...
XML Input (fixed to be well-formed)
<content> <para>Please click <link href="https://www.google.com">here</link> to navigate to Google search.</para> </content>
XSLT 1.0
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output indent="yes"/> <xsl:strip-space elements="*"/> <!-- Identity transform --> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="/content"> <html> <body> <xsl:apply-templates/> </body> </html> </xsl:template> <xsl:template match="para"> <p> <xsl:apply-templates select="@*|node()"/> </p> </xsl:template> <xsl:template match="link"> <a> <xsl:apply-templates select="@*|node()"/> </a> </xsl:template> </xsl:stylesheet>
Output
<html> <body> <p>Please click <a href="https://www.google.com">here</a> to navigate to Google search. </p> </body> </html>
It would also be a good idea to get a good book on XSLT and read through that first.
Update: I am glad to add this latest XSLT tutorial:
XSLT 2.0 and 1.0 Foundations, By Dimitre Novatchev (8:45 hours, 12 modules)
Also see these:
What's New in XSLT 3.0: Part 1, By Dimitre Novatchev (5:28 hours, 8 modules)
The Evolution of XPath: What’s New in XPath 3.0, By Dimitre Novatchev (4:29 hours, 7 modules)
XSLT: Programmer's Reference (Programmer to Programmer)
XSLT 2.0 Programmer's Reference (Programmer to Programmer)
alt text http://images.amazon.com/images/P/0764569090.01._SX140_SCLZZZZZZZ_.jpg
and
XSLT 2.0 and XPath 2.0 Programmer's Reference (Programmer to Programmer) :
alt text http://ecx.images-amazon.com/images/I/31bJBBvsybL._SL500_AA180_.jpg
Beginning XSLT
alt text http://isbn.abebooks.com/lbr/03/59/1590592603.jpg
Beginning XSLT 2.0: From Novice to Professional
alt text http://isbn.abebooks.com/mz/43/59/1590593243.jpg
XSLT and XPath On The Edge, Unlimited Edition
alt text http://ecx.images-amazon.com/images/I/51VEAtSLQbL._SL160_.jpg
XSLT Cookbook, Second Edition
alt text http://oreilly.com/catalog/covers/0596003722_cat.gif
Start with an identity transform. This will copy everything (elements, attributes, text, comments, processing-instructions) as-is.
Add more specific templates to override processing by the identity transform or the built-in template rules.
Example...
XML Input (fixed to be well-formed)
XSLT 1.0
Output
It would also be a good idea to get a good book on XSLT and read through that first.
T U T O R I A L S:
Update: I am glad to add this latest XSLT tutorial:
XSLT 2.0 and 1.0 Foundations, By Dimitre Novatchev (8:45 hours, 12 modules)
Also see these:
What's New in XSLT 3.0: Part 1, By Dimitre Novatchev (5:28 hours, 8 modules)
The Evolution of XPath: What’s New in XPath 3.0, By Dimitre Novatchev (4:29 hours, 7 modules)
Some tutorials by Norman Walsh:
Link to More tutorials
B O O K S
The classic books of Michael Kay on XSLT 1.0:
XSLT: Programmer's Reference (Programmer to Programmer)
and on XSLT 2.0 / XPath 2.0
XSLT 2.0 Programmer's Reference (Programmer to Programmer)
alt text http://images.amazon.com/images/P/0764569090.01._SX140_SCLZZZZZZZ_.jpg
and
XSLT 2.0 and XPath 2.0 Programmer's Reference (Programmer to Programmer) :
alt text http://ecx.images-amazon.com/images/I/31bJBBvsybL._SL500_AA180_.jpg
The books by Jeni Tennison:
Beginning XSLT
alt text http://isbn.abebooks.com/lbr/03/59/1590592603.jpg
Beginning XSLT 2.0: From Novice to Professional
alt text http://isbn.abebooks.com/mz/43/59/1590593243.jpg
XSLT and XPath On The Edge, Unlimited Edition
alt text http://ecx.images-amazon.com/images/I/51VEAtSLQbL._SL160_.jpg
And Sal Mangano's book:
XSLT Cookbook, Second Edition
alt text http://oreilly.com/catalog/covers/0596003722_cat.gif
Blogs:
S I T E S