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

Re: [xsl] Strange template behavior

Subject: Re: [xsl] Strange template behavior
From: Syd Bauman <Syd_Bauman@xxxxxxxxx>
Date: Tue, 4 Sep 2012 10:02:22 -0400

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" :-)


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

> 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