Subject: RE: [xsl] apply one template to another From: "Adam Retter" <adam.retter@xxxxxxxxxxxx> Date: Wed, 1 Nov 2006 15:13:57 -0000 |
WOW, thank you very much. Im amazed at the elegance of your solution - ive taken time to understand how the XPath expressions work in your solution and it really is very neat. Thanks very much again :-) Adam. -----Original Message----- From: David Carlisle [mailto:davidc@xxxxxxxxx] Sent: 01 November 2006 15:03 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] apply one template to another > My input document that could be processed is at the bottom of my > originial post, so it is!, sorry... <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" > <xsl:strip-space elements="*"/> <xsl:output indent="yes"/> <xsl:template match="*" mode="copy"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:apply-templates mode="copy"/> </xsl:copy> </xsl:template> <xsl:template match="*[not(self::xform)][name()=/root/*/name()]" mode="copy"> <xsl:copy-of select="/root/*[name()=name(current())]"/> </xsl:template> <xsl:template match="/root"> <xsl:apply-templates mode="copy" select="xform"/> </xsl:template> </xsl:stylesheet> $ saxon8 copy.xml copy.xsl <?xml version="1.0" encoding="UTF-8"?> <xform xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms"> <xforms:model ev:event="xforms-revalidate" ev:defaultAction="cancel"> <xforms:submission id="submit" action="http://localhost:8080/exist/servlet/db/CommunityDirectory/index. xql?action=savepage" method="post" replace="all"/> <xforms:instance> <page design="event"> <title/> <description/> <when> <start>2006-11-01T09:00:00.00</start> <end>2006-11-01T18:00:00.00</end> <occurs>Once</occurs> </when> <contact> <title>Miss</title> <firstname>Jo</firstname> <lastname>Smith</lastname> <telephone> <number type="Office">01404 812345</number> </telephone> </contact> <location> <address>The Old Institute</address> <address>Yonder Street</address> <town>Ottery St Mary</town> <county>Devon</county> <postcode>EX11 1XX</postcode> </location> <cost/> </page> </xforms:instance> </xforms:model> </xform>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] apply one template to ano, David Carlisle | Thread | SV: [xsl] [Announcement] Altova Cus, Per Osnes |
Re: [xsl] apply one template to ano, David Carlisle | Date | [xsl] XSL-List Guidelines, Mulberry Technologie |
Month |