Print

Print


Hi there,

There must be some code in the repo somewhere that does this, because 
the Guidelines provide the very useful "Contained by" section in the 
documentation of each individual element -- for instance:

<http://www.tei-c.org/release/doc/tei-p5-doc/en/html/ref-note.html>

Cheers,
Martin

On 11-08-11 09:32 AM, Syd Bauman wrote:
> I'm not sure, as I've never done this before, but I *think* the
> following will work:
>
> 1) Run the RELAX NG (XML syntax) schema through the program
>     'relaxng_refModel_resolver.xslt', appended. It is based on
>     http://wiki.tei-c.org/index.php/Relaxng_refAtt_resolver.xslt, but
>     works on elements instead of attributes. It takes out each
>     reference to a model class or macro, and replaces it with the
>     content of the model class or macro. The result is a huge, hard to
>     read, really inefficient schema, but it is easy to process.
>
> 2) Run the expanded schema through the 'list-RNG-parents.xslt'
>     program, appended. It goes through schema, and for each element,
>     finds every single reference to it, and for each reference puts
>     the @name of the closest ancestor<rng:element>  element in a list.
>
> Note that program #1 is in XSLT 1.0, program #2 is in XSLT 2.0 (in
> order to be able to use distinct-values -- if you have to use 1.0,
> could change program to spit out all parents, then `uniq` that
> output).
>
> Caveats:
> * I haven't tested this much at all.
> * There must be a more efficient way.
> * There's probably a better overall approach, too. Sebastian is the
>    expert on this stuff.
> * Could conceivably combine these two into 1 XSLT 2.0 stylesheet, but
>    I have reason to use the 1st part independently, so I didn't
>    combine them.
>

-- 
Martin Holmes
University of Victoria Humanities Computing and Media Centre
([log in to unmask])