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(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of
Bruce D'Arcus
Sent: 23 November 2003 05:50
To: XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] 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="{(_at_)id}(_dot_)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