[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: apply one template to another

Subject: Re: apply one template to another
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 1 Nov 2006 15:03:09 GMT
Re:  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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.