Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 4th, 2007, 08:21 AM
Authorized User
 
Join Date: Apr 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default template to copy namespaces

Could someone suggest a template that I could use to maybe copy all namespaces and schema locations from the original "<bb3:Reservations" and then place after "<bb3:CustomerVisits "

It seems that there is probably a better way then hard coding them.

From this:
<bb3:Reservations xmlns:bb3="http://www.ourbedandbreakfast.com/sample1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ourbedandbreakfast.com/reserve_schema.xsd">

To This:
<bb3:CustomerVisits xmlns:bb3="http://www.ourbedandbreakfast.com/sample1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ourbedandbreakfast.com/reserve_schema.xsd">

Current XSL:

<xsl:template match="bb3:Reservations">
  <bb3:CustomerVisits xmlns:bb3="http://www.ourbedandbreakfast.com/sample1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ourbedandbreakfast.com/reserve_schema.xsd">
  <xsl:for-each-group select="bb3:Reservation/bb3:Customer" group-by="concat(@FirstName, '~', @LastName)">
         <bb3:Booking>
             <xsl:copy>
               <xsl:copy-of select="@*"/>
               <xsl:apply-templates mode="copy"/>
             </xsl:copy>
    <xsl:for-each select="current-group()">
      <InvoiceNum><xsl:value-of select="../@InvoiceNum"/></InvoiceNum>
    </xsl:for-each>
    </bb3:Booking>
  </xsl:for-each-group>
   </bb3:CustomerVisits>
</xsl:template>







Similar Threads
Thread Thread Starter Forum Replies Last Post
Namespaces and DLLs Akobold C# 0 March 18th, 2007 08:08 PM
Namespaces Amateur BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 November 27th, 2006 05:19 PM
namespaces anchal C# 1 July 3rd, 2006 02:53 PM
Need to copy all nodes, attributes, and namespaces juaniux XSLT 4 October 22nd, 2004 04:39 PM
NAMESPACES - WHAT ARE THEY? p_nut33 C# 2 July 31st, 2003 03:18 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.