On 12/02/2013 21:35, Eric Harbeson wrote:
This is close, but it doesn't include the xmlns line, which appears to be
needed for it to validate correctly. The XSLT I have below seems like it should
do what I want, but it produces an error in the xsl:namespace declaration.
<xsl:template match="ead">
<xsl:element name="ead">
<xsl:namespace name="">urn:isbn:1-931666-22-9</xsl:namespace>
<xsl:attribute name="xsi:schemaLocation">urn:isbn:1-931666-22-9
http://www.loc.gov/ead/ead.xsd</xsl:attribute>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
...
</xsl:stylesheet>
The xsl:element instruction creates the ead element in no-namespace, and
you then attempt to add a namespace node that binds the default
namespace to "urn:isbn:1-.....". Adding a namespace node to an existing
element can't change the name(space) of the element, and is an error if
it's inconsistent with the name of the element. You need to create the
element in the right namespace to start with, and then the namespace
node will be created for you automatically:
<xsl:element name="ead" namespace="urn:isbn:1-931666-22-9">
Alternatively, use a literal result element:
<ead xmlns="urn:isbn:1-931666-22-9">
though this doesn't give you quite such detailed control over namespaces.
Michael Kay
Saxonica
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--