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

RE: multi-document question

Subject: RE: multi-document question
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Sun, 23 Nov 2003 16:05:32 -0000
xml multi document
The default template rule for attributes copies the string value of the
attribute as text. Either copy the attributes explicitly using
<xsl:copy-of select="@*"/>, or write a template rule that copies them,

<xsl:template match="@*"><xsl:copy/></xsl:template>

Michael Kay

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Bruce D'Arcus
> Sent: 23 November 2003 05:50
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  multi-document question
> 
> 
> 
> I'm a non-programmer relative newbie to xslt, and am stuck on the 
> following problem.  I want to take this sort of file:
> 
> <modsCollection>
> 	<mods id="1">
> 		<abc>one</abc>
> 	</mods>
> 	<mods id="2">
> 		<abc>two</abc>
> 	</mods>
> </modsCollection>
> 
> ...and to break it into individual files that exactly match 
> the content 
> of the mods element.  I also want these files to be named 
> based on the 
> id attribute on the mods element.  So, I'd like, for example, a file 
> called "1.mods" whose content is:
> 
> 	<mods id="1">
> 		<abc>one</abc>
> 	</mods>
> 
> Below is what I have so far, which is getting me individual files 
> correctly named, but content like this:
> 
> <?xml version="1.0"?>
> <mods>oneone</mods>
> 
> What am I doing wrong, and how do I fix it?
> 
> Thanks,
> Bruce
> ================================
> <?xml version='1.0' encoding='utf-8'?>
> <xsl:stylesheet version="1.0"
>                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                  xmlns:exsl="http://exslt.org/common"
>                  extension-element-prefixes="exsl">
>        <xsl:output method="xml" version="1.0" encoding="utf-8" 
> indent="yes"/>
>           <xsl:strip-space elements="*"/>
> 
>     <xsl:template match="mods">
>          <exsl:document href="{@id}.mods" method="xml">
>          <xsl:copy>
>             <xsl:apply-templates select="@* | node()"/>
>          </xsl:copy>
>          </exsl:document>
>     </xsl:template>
> 
> </xsl:stylesheet>
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.