Using <equiv/> for multiple elements

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Using <equiv/> for multiple elements

Joey Takeda
Hi there,

Can <equiv> be used (or is <equiv> the right mechanism to use) to map multiple elements to element attribute combinations? Basically, I'm attempting to use <equiv> to map multiple elements to element attribute combinations like so:

<foo type="a" subtype="b"> ==> <my:a type="b">
<foo type="c" subtype="b" ==> <my:c type="b">

The example in the guidelines shows a mapping from <hi rend="bold"> ==> <my:bo> (http://www.tei-c.org/release/doc/tei-p5-doc/en/html/TD.html#TDcrystalsCEdc). If I wanted to map <hi rend="italic"> ==> <my:it>, would I add another <equiv> and another <elementSpec> with <equiv>s pointing to a stylesheet like so:

<elementSpec ident="hi" mode="change">
 <equiv name="BOLD"/>
<equiv name="ITALIC"/>
 <attList>
  <attDef ident="rend" mode="change">
   <valList>
    <valItem ident="bold"/>
<valItem ident="italic"/>
   </valList>
  </attDef>
 </attList>
</elementSpec>
<elementSpec ident="bo" mode="add" ns="http://example.com/ns/mynamespace">
 <equiv name="BOLD" mimeType="text/xsl" filter="equiv.xsl"/>
<desc>bold typography</bold>
<!--....-->
</elementSpec>
<elementSpec ident="it" mode="add"  ns="http://example.com/ns/mynamespace">
<equiv name="ITALIC" filter="equiv.xsl" mimeType="text/xsl"/>
<desc>italic type</desc>
<!--....-->
</elementSpec>

Many thanks,
Joey
Reply | Threaded
Open this post in threaded view
|

Re: Using <equiv/> for multiple elements

Syd Bauman-10
I think the short answer is "yes", <equiv> can be used to map
multiple added elements each to a particular TEI element/attr
combination. And I think you have the way to do it almost exactly
right. (Except for the typo of "</bold>" where you meant "</desc>".)

The only thing I would change is I don't think that the <equiv>
children of the <elementSpec> for "hi" are necessary or appropriate.
(At least, I have never put them there, and they don't seem to change
the output schema at all. That said, it seems like a good way to be
explicit. :-)

> Can <equiv> be used (or is <equiv> the right mechanism to use) to
> map multiple elements to element attribute combinations? Basically,
> I'm attempting to use <equiv> to map multiple elements to element
> attribute combinations like so:
>
> <foo type="a" subtype="b"> ==> <my:a type="b">
> <foo type="c" subtype="b" ==> <my:c type="b">
>
> The example in the guidelines shows a mapping from <hi rend="bold"> ==>
> <my:bo> (http://www.tei-c.org/release/doc/tei-p5-doc/en/html/TD.
> html#TDcrystalsCEdc). If I wanted to map <hi rend="italic"> ==> <my:it>,
> would I add another <equiv> and another <elementSpec> with <equiv>s
> pointing to a stylesheet like so:
>
> <elementSpec ident="hi" mode="change">
>  <equiv name="BOLD"/>
> <equiv name="ITALIC"/>
>  <attList>
>   <attDef ident="rend" mode="change">
>    <valList>
>     <valItem ident="bold"/>
> <valItem ident="italic"/>
>    </valList>
>   </attDef>
>  </attList>
> </elementSpec>
> <elementSpec ident="bo" mode="add" ns="http://example.com/ns/mynamespace">
>  <equiv name="BOLD" mimeType="text/xsl" filter="equiv.xsl"/>
> <desc>bold typography</bold>
> <!--....-->
> </elementSpec>
> <elementSpec ident="it" mode="add"  ns="http://example.com/ns/mynamespace">
> <equiv name="ITALIC" filter="equiv.xsl" mimeType="text/xsl"/>
> <desc>italic type</desc>
> <!--....-->
> </elementSpec>
Reply | Threaded
Open this post in threaded view
|

Re: Using <equiv/> for multiple elements

James Cummings-5


Just to chip in, if you were only ever going to be using <hi> to mark italics one could also just rename it to <my:it> with <altIdent>.  However, that doesn't really get you the element/attribute combination. To point to the mapping you need equiv pointing to something which documents and hopefully reverses the modification. (e.g. an ac-dc.xsl, equiv.xsl, or whatever stylesheet where a named template 'ITALIC' renames this back to <hi rend="italic">). The processing currently fails if you put multiple altIdent.


Best wishes,

James 


--

Dr James Cummings, [hidden email]

School of English Literature, Language, and Linguistics, Newcastle University




From: TEI (Text Encoding Initiative) public discussion list <[hidden email]> on behalf of Syd Bauman <[hidden email]>
Sent: 06 October 2017 16:00
To: [hidden email]
Subject: Re: Using <equiv/> for multiple elements
 
I think the short answer is "yes", <equiv> can be used to map
multiple added elements each to a particular TEI element/attr
combination. And I think you have the way to do it almost exactly
right. (Except for the typo of "</bold>" where you meant "</desc>".)

The only thing I would change is I don't think that the <equiv>
children of the <elementSpec> for "hi" are necessary or appropriate.
(At least, I have never put them there, and they don't seem to change
the output schema at all. That said, it seems like a good way to be
explicit. :-)

> Can <equiv> be used (or is <equiv> the right mechanism to use) to
> map multiple elements to element attribute combinations? Basically,
> I'm attempting to use <equiv> to map multiple elements to element
> attribute combinations like so:
>
> <foo type="a" subtype="b"> ==> <my:a type="b">
> <foo type="c" subtype="b" ==> <my:c type="b">
>
> The example in the guidelines shows a mapping from <hi rend="bold"> ==>
> <my:bo> (http://www.tei-c.org/release/doc/tei-p5-doc/en/html/TD.
> html#TDcrystalsCEdc). If I wanted to map <hi rend="italic"> ==> <my:it>,
> would I add another <equiv> and another <elementSpec> with <equiv>s
> pointing to a stylesheet like so:
>
> <elementSpec ident="hi" mode="change">
>  <equiv name="BOLD"/>
> <equiv name="ITALIC"/>
>  <attList>
>   <attDef ident="rend" mode="change">
>    <valList>
>     <valItem ident="bold"/>
> <valItem ident="italic"/>
>    </valList>
>   </attDef>
>  </attList>
> </elementSpec>
> <elementSpec ident="bo" mode="add" ns="http://example.com/ns/mynamespace">
>  <equiv name="BOLD" mimeType="text/xsl" filter="equiv.xsl"/>
> <desc>bold typography</bold>
> <!--....-->
> </elementSpec>
> <elementSpec ident="it" mode="add"  ns="http://example.com/ns/mynamespace">
> <equiv name="ITALIC" filter="equiv.xsl" mimeType="text/xsl"/>
> <desc>italic type</desc>
> <!--....-->
> </elementSpec>