[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Strange template behavior


Subject: Re: [xsl] Strange template behavior
From: "Mark" <mark@xxxxxxxxxxxx>
Date: Tue, 4 Sep 2012 07:07:08 -0700

No, it was the accidental use of HTML output instead of XML.
Thanks.

-----Original Message----- From: Syd Bauman
Sent: Tuesday, September 04, 2012 7:02 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Strange template behavior


Are you sure you named both tags of the renamed element to "Link"? It
sounds like you inadvertently re-named the start tag to "Link" and
the end-tag to something else (either "SomethingElse" or "link" :-)

I.e.:

<xsl:template match="Xref" mode="link">
   <Link>
     <xsl:attribute name="dumb" select="'what'"></xsl:attribute>
  </link>
</xsl:template>


I am using XSLT2 and the free version of Saxon 9. When I run this with
simple input data and a simple stylesheet, it works, but in my very complex
stylesheet dealing with a very large input, it fails in the first instance
and succeeds in the second. I am baffled. Here is the story:


Below is a template. When it is called, it fails to terminate the element in
the output XML and gives the error:


"Error on line 273 column 9 of 33Subjects.xml:
  SXXP0003: Error reported by XML parser: The element type "Link" must be
terminated by the  matching end-tag "</Link>". Transformation failed:
Run-time errors were reported"

But rename the element within this template and it works. Does the fact that
the mode is called "link" have anything to do with its failure?


[I know I am not showing the data input and style sheet -- they are very,
very large, but I swear the element name change is the only alteration I
make to cause this.]

Mark

Failing scenario
Fails. Outputs: <Link dumb="what"> <!---No termination-->

<xsl:template match="Xref" mode="link">
    <Link>
      <xsl:attribute name="dumb" select="'what'"></xsl:attribute>
   </Link>
</xsl:template>

Successful scenario
Has no problem. Outputs:  <SomethingElse dumb="what"/> <!---Terminated-->

<xsl:template match="Xref" mode="link">
    <SomethingElse>
      <xsl:attribute name="dumb" select="'what'"></xsl:attribute>
   </SomethingElse>
</xsl:template>


Current Thread
Keywords
xml