xsl-list
[Top] [All Lists]

namespace prefix weirdness

2004-08-16 14:43:31

OK, I started over just to see if I can create a version of the complete document as a temporary tree with some additional text inserted along with the mods records.

I'm finding, however, some bizarre behavior with namespace prefixes. Why might I end up with something like the "_0" prefix on that mods element below? This is the latest Saxon 8 release.

         <modsCollection xmlns="http://www.loc.gov/mods/v3";>
            <key xmlns="">test</key>
<_0:mods xmlns="" xmlns:_0="http://www.loc.gov/mods/v3"; ID="Mitchell1996b">
               <titleInfo xmlns="http://www.loc.gov/mods/v3";>
                  <title>Introduction</title>
                  <subTitle>Public Space and the City</subTitle>
               </titleInfo>

Here's my stylesheet (minus header):

<xsl:template match="/">
  <xsl:variable name="temp">
    <xsl:apply-templates mode="enhanced-bib"/>
  </xsl:variable>
  <xsl:apply-templates select="$temp" mode="modified"/>
</xsl:template>

<xsl:template match="db:article" mode="enhanced-bib">
  <article xmlns="http://docbook.org/docbook-ng";>
    <xsl:copy>
      <xsl:apply-templates mode="enhanced-bib"/>
    </xsl:copy>
  </article>
</xsl:template>

<xsl:template match="db:info" mode="enhanced-bib">
  <info xmlns="http://docbook.org/docbook-ng";>
    <xsl:copy-of select="."/>
  </info>
</xsl:template>

<xsl:template match="db:section" mode="enhanced-bib">
  <section xmlns="http://docbook.org/docbook-ng";>
    <xsl:copy-of select="."/>
  </section>
</xsl:template>

<xsl:template match="db:bibliography" mode="enhanced-bib">
  <bibliography xmlns="http://docbook.org/docbook-ng";>
<xsl:apply-templates select="mods:modsCollection" mode="enhanced-bib"/>
  </bibliography>
</xsl:template>

<xsl:template match="mods:modsCollection" mode="enhanced-bib">
  <modsCollection xmlns="http://www.loc.gov/mods/v3";>
    <xsl:apply-templates select="mods:mods"  mode="enhanced-bib"/>
  </modsCollection>
</xsl:template>

<xsl:template match="mods:mods" mode="enhanced-bib">
    <key>test</key>
    <xsl:copy-of select="."/>
</xsl:template>

<xsl:template match="/" mode="modified">
  <xsl:copy-of select="*"/>
</xsl:template>