logo       

default and mathml namespace problem (xalan bug?): msg#00032

Subject: default and mathml namespace problem (xalan bug?)

I have a problem with namespaces and I produced a very simple example to demonstrate it. I think it is specific to xalan as I don't get the same behaviour from other processors. Any help would be appreciated. Perhaps I am doing something completely wrong or it is the version of Xalan I am using (2.6)

   So... lets say that we have the following file:

<?xml version="1.0" encoding="UTF-8"?>
<assessmentItem xmlns="http://www.imsglobal.org/xsd/imsqti_v2p0"; xmlns:m="http://www.w3.org/1998/Math/MathML";>
          <m:math>
         <m:mrow>
            <m:mn>2</m:mn>
           <m:mo>&#x002b;</m:mo>
           <m:mi>p</m:mi>
          </m:mrow>
       </m:math>
</assessmentItem>

and we want to produce the following xml (that looks like html -its actually jsp but ignore that) and we want m:math to be copied to the math namespace="...." together with all subsequent element but all the m:mi elements would be copied in another namespace

 <?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"; xmlns:mathqti="http://www.maths.ed.ac.uk/mathqti";>
<body>
<math xmlns="http://www.w3.org/1998/Math/MathML";>
         <mrow>
            <mn>2</mn>
           <mo>+</mo>
           <mathqti:mi identifier="p"/>
          </mrow>
       </math>
</body>
</html>

But using the following XSLT I get

<mathqti:mi xmlns="http://www.w3.org/1999/xhtml"; identifier="p"/>

I found ways to bypass the problem by not having a default namespace but this creates other problems in my stylesheet later on so I 'd like to have the default namespace unless this is wrong and it seems to me that it isn't (as I said other processors manage fine)

Any ideas ?

Thanks,

Manolis

XSLT:




<xsl:stylesheet
 xmlns="http://www.w3.org/1999/xhtml";
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:m="http://www.w3.org/1998/Math/MathML"; xmlns:mathqti="http://www.maths.ed.ac.uk/mathqti";
 xmlns:qti = "http://www.imsglobal.org/xsd/imsqti_v2p0";

 exclude-result-prefixes="qti m"
 version="1.0">

<xsl:template match="qti:assessmentItem">
   <html>
     <body>
       <xsl:apply-templates/>
     </body>
   </html>
</xsl:template>

<!-- we want all m: elements to be copied-->
<xsl:template match="m:*">
<xsl:element name="{local-name(.)}" namespace="http://www.w3.org/1998/Math/MathML";>
  <xsl:copy-of select="@*"/>
  <xsl:apply-templates/>
</xsl:element>
</xsl:template>

<!-- lets assume that we want all m:mi elements to
    be converted to some other namespace  -->
<xsl:template match="m:mi">
     <xsl:element name="mathqti:mi">
<xsl:attribute name="identifier"><xsl:value-of select="string(.)"/></xsl:attribute>
     </xsl:element>
</xsl:template>



</xsl:stylesheet>




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
linux.arklinux....    user-groups.lin...    kde.usability/2...    ietf.ipp/2002-0...    mail.spam.spamc...    os.netbsd.devel...    audio.cd-record...    text.unicode.de...    php.documentati...    games.fps.halfl...    window-managers...    suse.oracle.gen...    bug-tracking.gn...    video.dvdrip.us...    xfree86.cvs/200...    java.netbeans.m...    network.argus/2...    culture.sf.kill...    debian.ports.al...    freebsd.questio...    qplus.devel/200...    handhelds.palm....   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe