Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] apply one template to another

From: David Carlisle <davidc@--------->
To:
Date: 11/1/2006 3:04:00 PM
> 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>


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent