[xsl] multi-document question

Subject: [xsl] multi-document question
From: "Bruce D'Arcus" <bdarcus@xxxxxxxxxxx>
Date: Sun, 23 Nov 2003 00:50:21 -0500

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



Current Thread