Menu

#659 OxGarage fails to convert ODD

AMBER
closed-fixed
nobody
Oxgarage (1)
5(default)
2014-04-04
2014-04-03
No

The attached ODD file will not convert to a RelaxNG XML schema in Oxgarage. It fails with:

Error occured. Please check the filetype and try again.?

Error: class pl.psnc.dl.ege.exception.ConverterException

A sequence of more than one item is not allowed as the result of function tei:generateRefPrefix() (

I think the ODD is valid, and there's nothing unusual about it. Roma also fails with it.

1 Attachments

Discussion

  • Lou Burnard

    Lou Burnard - 2014-04-03

    Interesting. I have no problem running this conversion from within Oxygen, but that's because my Oxygen framework hasn't been updated for a while. If I do it with a command line teitorng using my local up to date copy of the stylesheets I get " A sequence of more than one item is not allowed as the result of function tei:generateRefPrefix() ("macro.anyXML", "macro.anyXML") ; SystemID: file:/usr/share/xml/tei/stylesheet/odds/teiodds.xsl; Line#: 2339; Column#: -1

     
  • Martin Holmes

    Martin Holmes - 2014-04-03

    I was able to run it in Oxygen too on my home machine, which doesn't have an up-to-date TEI package, but here at work it fails with a fatal but unspecified error (presumably the same one). So this must be a very recent bug.

     
  • Martin Holmes

    Martin Holmes - 2014-04-03

    The problem is around line 2348 in odds/teiodds.xsl. This section:

          <xsl:when test="key('IDENTS',$lookup)">
        <xsl:for-each select="key('IDENTS',$lookup)">
          <xsl:choose>
            <xsl:when test="@prefix and starts-with($fullname,@prefix)">
              <xsl:value-of select="$fullname"/>
            </xsl:when>
            <xsl:when test="@prefix">
              <xsl:value-of select="concat(@prefix,$fullname)"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="concat($generalPrefix,$fullname)"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:for-each>
          </xsl:when>
    

    is generating a sequence rather than a single xs:string. I was able to work around it by adding a couple of bits like this:

          <xsl:when test="key('IDENTS',$lookup)">
    <xsl:variable name="temp">
        <xsl:for-each select="key('IDENTS',$lookup)">
          <xsl:choose>
            <xsl:when test="@prefix and starts-with($fullname,@prefix)">
              <xsl:value-of select="$fullname"/>
            </xsl:when>
            <xsl:when test="@prefix">
              <xsl:value-of select="concat(@prefix,$fullname)"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="concat($generalPrefix,$fullname)"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:for-each>
    </xsl:variable>
    <xsl:value-of select="$temp[1]"/>
          </xsl:when>
    

    so that demonstrates where the problem is, but I don't know enough to know whether I'm breaking something when I do that; the resulting schema seems to make <app> invalid inside <egXML>, which is definitely not desirable.

     
  • Lou Burnard

    Lou Burnard - 2014-04-03

    Looking at your ODD source, I see you have a redefinition of macro.anyXML which is given in mode="add". Since you have also included module tei with no modification, this is probably an error, but (as we all know) odd processors are not required to report errors.

    Change it to mode="change" and you should be able to generate a schema just fine with the current stylesheets.

     
  • Lou Burnard

    Lou Burnard - 2014-04-03

    Actually it's more complicated than that... macro.anyXML is defined in tagdocs (not tei) for which you do specify some inclusions. There used to be a BUG whereby the presence/absence of macros was affected by the use of @include/@except in the same way as that of elements. This has now been fixed: definitions for all macros and classes supplied by a module are always included by default. Hence you get macro.anyXML twice. Before the bug was fixed, you wouldn't have got macro.anyXML at all because you specified @include on the moduleRef for tagdocs. Which is probably why you added it in the first place!

     
  • Martin Holmes

    Martin Holmes - 2014-04-03

    You're right: changing @mode to "change" solves the problem. I didn't actually write that bit so I don't know whether you're right about the reason for it; it could have originated in an oddbyexample operation, or Ron might have added it. Anyway, it's fixed. The question is whether it's worth doing anything to make this error easier to figure out -- should the ODD file have shown as invalid (because macro.anyXML was included twice), or should the XSLT have reported the bug more helpfully? Or is this just too obscure to worry about?

     
  • Lou Burnard

    Lou Burnard - 2014-04-03
    • status: open --> closed-fixed
     
  • Lou Burnard

    Lou Burnard - 2014-04-03

    You (or Ron) are not the first person to have been caught out by the original bug, but since it's now been fixed, I don't think we'll see many re-occurrences. In general, as I noted above, it's important to remember that ODD processors aren't required to do error checking. And in fact the XSLT error report was very helpful (because it showed us that there were two references to macro.anyXML where there should have been only one). So I am closing this ticket, unless Ron has anything to add.

     
  • rvdb

    rvdb - 2014-04-04

    Sorry, I'm probably chiming in too late, but I might shed some light on why on earth I was doing this. Apparently, I had to redefine <egXML> in the ODD; otherwise the generated RelaxNG schema omitted the macro.anyXML declaration from the definition of <egXML>:

    <zeroOrMore>
      <group>
        <choice>
          <text/>
        </choice>
      </group>
    </zeroOrMore>
    

    The only way to make the ODD processor pick up the macro.anyXML reference was to redefine both macro.anyXML and <egXML> in the ODD.

    Yet, I've retested with the updated Oxygen package, and now it seems to generate a correct definition of <egXML> in RelaxNG without the need for redefining it in the ODD:

    <zeroOrMore>
      <group>
        <choice>
          <text/>
          <ref name="macro.anyXML"/>
        </choice>
      </group>
    </zeroOrMore>
    

    I don't know if this was related to this fix; otherwise you've managed to kil two birds with one stone.