Re: prep.xsl

Daniel Veillard <[email protected]>
Newsgroups gmane.text.xml.relaxng.general
Message-ID <[email protected]>
On Mon, Sep 29, 2003 at 01:34:11PM -0700, Cheng-Chang Wu wrote:
> I've found prep.xsl, thanks for the help.
> 
> My program can still not handle all of the relaxng
> constructs, but it can already read the relaxng file I
> am using in my project.
> 
> I've had problems to determine the nullability of ref
> element. In section 4.19 of the specification it says
> one can replace the expandable ref element with its
> definition. THIS MUST NOT RESULT IN A LOOP. I can't
> grasp this well. Ex.
> 
> <define name="test>
>   <choice>
>      <ref name="test">
>      <element name="test"/>
>   </choice>
> </define>
> 
> Isn't this a correct relaxng schema? I don't know

The simplest way I could understand the spec was in term of input.
Basically the loop is invalid because it consume no input.
You can go from the top definition of the test define
to the recursive reference without any change in the input.
On the other hand

  <define name="test>
    <choice>
      <element name="bar">
        <ref name="test">
      </element>
      <element name="test"/>
    </choice>
  </define>

 is okay because to go from the definition to the reference
you had to consume the "bar" element input.
Still the best way is to follow the spec description of the semantic
but sometimes taking a different approach can help seeing the 
concept behind the formalism.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
[email protected]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.