xmlxsltxslt-2.0oxygenxml

xslt unwanted @part adds in transformation


I'm trying to do a basic XSLT transformation of the first <p> tag into a <head> tag. It works, but problem is that I use the <xsl:copy-of> template for the other <p> tag and it results in a <p part="N"> with this annoying @part.

this is the XML tree :

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng" type="application/xml"
    schematypens="http://purl.oclc.org/dsdl/schematron"?>
<TEI xmlns="http://www.tei-c.org/ns/1.0">
  <teiHeader>
      <fileDesc>
         <titleStmt>
            <title>Title</title>
         </titleStmt>
         <publicationStmt>
            <p>Publication Information</p>
         </publicationStmt>
         <sourceDesc>
            <p>Information about the source</p>
         </sourceDesc>
      </fileDesc>
  </teiHeader>
  <text>
      <body>
         <p>Title</p>
         <p>Some text here.</p>
      </body>
  </text>
</TEI>

this is my XSL stylesheet :

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:tei="http://www.tei-c.org/ns/1.0"
    xpath-default-namespace="http://www.tei-c.org/ns/1.0"
    exclude-result-prefixes="xs tei"
    xmlns="http://www.tei-c.org/ns/1.0"
    version="2.0">
    <xsl:output method="xml" indent="yes" omit-xml-declaration="no" encoding="UTF-8"/>
    <xsl:template match="/TEI/teiHeader"/>
    <xsl:template match="/TEI//body">
        <div>
            <head>
                <xsl:value-of select="./p[1]"/>
            </head>
            <xsl:copy-of select="./p[2]"/>
        </div>
    </xsl:template>
</xsl:stylesheet>

and the result tree is :

<?xml version="1.0" encoding="UTF-8"?>
<div xmlns="http://www.tei-c.org/ns/1.0">
   <head>Title</head>
   <p part="N">Some text here.</p>
</div>

I find out that when I remove this statements in the input tree :

<?xml-model href="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng" type="application/xml"
    schematypens="http://purl.oclc.org/dsdl/schematron"?>

the @part disappears from the output tree. Can you explain me why ? What are all of this xml-model ?

I'm using Oxygen XML Editor 24.1 and Saxon-EE 10.6 (same result with Saxon-PE 10.6 and Saxon-HE 10.6).

Thank you !


Solution

  • In the Oxygen Preferences->"XML / XML Parser / RELAX NG" page you can uncheck the "Add default attributes" checkbox.