xsl-list
[Top] [All Lists]

Re: [xsl] Strange template behavior

2012-09-04 09:02:35
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>





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--