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]
RE: [xml-dev] What is causing this XSLT NAMESPACE_ERR?

My guess would be that this error occurs while writing a DOM to hold the
output. Are you writing to a DOM? (If so, why?) Does the error go away if
you serialize the result instead?

At any rate, it looks to me like a problem that's specific to the (Xalan?)
product. Try it on Saxon.

Incidentally, your predicate 

match="credit[@page and (@page != '1')]"/>

can be rewritten

match="credit[@page != '1']"/>

since the predicate will be false if there is no @page attribute.

Michael Kay
http://www.saxonica.com/


> -----Original Message-----
> From: Michael Good [mailto:musicxml@gmail.com] 
> Sent: 08 June 2007 00:51
> To: xml-dev@lists.xml.org
> Subject: [xml-dev] 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
> 
> ______________________________________________________________
> _________
> 
> XML-DEV is a publicly archived, unmoderated list hosted by 
> OASIS to support XML implementation and development. To 
> minimize spam in the archives, you must subscribe before posting.
> 
> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
> subscribe: xml-dev-subscribe@lists.xml.org List archive: 
> http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
> 



[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