XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
What is causing this XSLT NAMESPACE_ERR?

I have a MusicXML 2.0 document that has this fragment:

  <credit page="1">
    <credit-words default-x="1580" default-y="3799"
                         font-size="24" font-weight="bold" justify="center"
                         valign="top" xml:lang="fr">La Bohème
</credit-words>
    <credit-words font-size="16" font-weight="normal">Act I—In
Soffitta</credit-words>
  </credit>

The page attribute for the credit element is new to MusicXML 2.0. In
MusicXML, all credits were on page 1. So our XSLT 1.0 stylesheet that
transforms to MusicXML 1.1 removes the page attribute, along with any
credit elements that are not on page 1:

  <!-- Remove a credit that is not on page 1 -->
 <xsl:template
    match="credit[@page and (@page != '1')]"/>

  <!-- Remove the page attribute for page 1 credits -->
  <xsl:template
    match="credit/@page[. = '1']"/>

All works well until there is an xml:lang attribute in the
credit-words element, as in the above example. When this happens,
Xerces 2.9.0 gives us an error:

XSLT fatal error at line 1: org.w3c.dom.DOMException: NAMESPACE_ERR:
An attempt is made to create or change an object in a way which is
incorrect with regard to namespaces.

If I remove the rule to get rid of the page attribute, the error
message goes away. We don't use any namespace or default namespaces in
MusicXML except for some XLink constructs and the xml:lang attribute.

Our generic identity transformation for elements and attributes is:

  <xsl:template match="*|@*|comment()|processing-instruction()">
    <xsl:copy><xsl:apply-templates
        select="*|@*|comment()|processing-instruction()|text()"
    /></xsl:copy>
  </xsl:template>

Can anybody explain what might be going on here to cause the error?
How would removing a page attribute in a parent element relate to the
xml:lang attribute in the child element? Am I doing something wrong in
one of these rules that is doing something unintended?

Thanks for any assistance!

Best regards,

Michael Good
Recordare LLC
www.recordare.com


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS