ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* TEI - conTeXt
@ 2010-12-09 23:20 Jon Crump
  2010-12-10 17:57 ` Thomas Schmitz
  0 siblings, 1 reply; 6+ messages in thread
From: Jon Crump @ 2010-12-09 23:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users

All,

More naive questions about xml and context. I'm finding this slow
going and documentation opaque or just thin on the ground. I have XML
markup like this:

<ref target="#N003-06"> reference term</ref>

where the reference text is in

<div xml:id="notes">
    <note xml:id="N003-06">reference text</note
    .
    .
    . etc.
</div>

I need to set this as an endnote reference. Can anyone give me a hint
as to how a context environment file should look to achieve this?

Thomas's excellent tutorial at http://wiki.contextgarden.net/TEI_xml
is a great help, but my grasp of the underlying protocols is fragile.
More practical examples of TEI (or other xml texts)-> ConTeXt -> PDF
would sure come in handy.

thanks,
jon
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: TEI - conTeXt
  2010-12-09 23:20 TEI - conTeXt Jon Crump
@ 2010-12-10 17:57 ` Thomas Schmitz
  2010-12-10 20:00   ` Jon Crump
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Schmitz @ 2010-12-10 17:57 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Thu, 9 Dec 2010 15:20:06 -0800
  Jon Crump <jjcrump@uw.edu> wrote:
> All,
> 
> More naive questions about xml and context. I'm finding 
>this slow
> going and documentation opaque or just thin on the 
>ground. 

Before I try and help you with your question: you posted 
another problem on Nov 24 and got replies. Has this issue 
been solved?

> More practical examples of TEI (or other xml texts)-> 
>ConTeXt -> PDF
> would sure come in handy.
> 
You're more than welcome to contribute such examples. 
Remember, this is a volunteer effort.

Thomas
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: TEI - conTeXt
  2010-12-10 17:57 ` Thomas Schmitz
@ 2010-12-10 20:00   ` Jon Crump
  2010-12-10 20:40     ` Thomas Schmitz
  0 siblings, 1 reply; 6+ messages in thread
From: Jon Crump @ 2010-12-10 20:00 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Thomas,

Thanks for responding. Yes, thanks to some help from Idris, Khaled, et
alia, I've got an ara-sty.tex environment file that sets up the
Scheherezade font and am getting very nice looking arabic text. I'm
now trying to get my arms around some basic elements of the conTeXt
system for dealing with xml.

Thanks to your TEI tutorial, I've got some good results for flushing
elements identified by tag name and by named attribute like this:

\xmlsetsetup{#1}{head[@type='chapter']}{xml:head:chapter}
\xmlsetsetup{#1}{p}{xml:p}

and the like. I'm now trying to figure out how to address elements in
the tei more precisely, like how to address the content nodes in the
<div xml:id="notes">, like <note xml:id="N012-10">,  in order to use
their contents while setting elements like <ref target="#N012-10">
with a \footnote command (though we may, in fact, need to put these
elsewhere in an 'endnotes' section.).

I've sought in vain for the answers to simple questions like how to
address nodes identified by xml:id. In setting up a minimal example,
I've tried to do this:

with the xml:

<?xml version="1.0" encoding="utf-8"?>
<body>
	<text>
		<div xml:id="a">
			foo
		</div>
		<div xml:id="b">
			bar
		</div>
	</text>
</body>

set foo and not bar. This, for example, does not work:

\startxmlsetups xml:minimalsetups
	\xmlsetsetup{#1}{*}{-}
	\xmlsetsetup{#1}{body|text|div}{xml:*}
	\xmlsetsetup{#1}{div[@xml:id='a']}{xml:div}
\stopxmlsetups

context complaining that xml:id='a' is not a valid lpath expression.
As you can see, I'm not getting some basic things about how to specify
and traverse the xml, much less applying the correct context commands
to get the content and formatting I need.

Another thing I'm going to need to do is to parse the text of certain
element attributes. For example, divs to be set in arabic are
distinguished from divs to be set in latin only by their xml:lang
attributes. I will need to be able to distinguish between ar-Arab,
en-Latn, and possibly also ar-Latn and more complex subtags like
"az-Arab-IR" as specified in
<http://www.rfc-editor.org/rfc/bcp/bcp47.txt>

Any clues you might care to offer, or examples that you know of, would
be gratefully received. I hesitate to attach the xml and tex files I'm
working with here, being unfamiliar with the protocols of the list,
but if it would help to see what I'm trying to work with, I could
certainly do that. More than this, I will certainly post on the wiki
some documentation and examples from this current project once I have
something to contribute that works. I'd like to extend your tutorial
for others who have TEI texts that they would like to typeset; indeed,
making public such documentation in their appropriate fora is part of
the remit of our project.

All at sea in Seattle,
Jon

On Fri, Dec 10, 2010 at 9:57 AM, Thomas Schmitz <tschmit1@uni-bonn.de> wrote:
> On Thu, 9 Dec 2010 15:20:06 -0800
>  Jon Crump <jjcrump@uw.edu> wrote:
>>
>> All,
>>
>> More naive questions about xml and context. I'm finding this slow
>> going and documentation opaque or just thin on the ground.
>
> Before I try and help you with your question: you posted another problem on
> Nov 24 and got replies. Has this issue been solved?
>
>> More practical examples of TEI (or other xml texts)-> ConTeXt -> PDF
>> would sure come in handy.
>>
> You're more than welcome to contribute such examples. Remember, this is a
> volunteer effort.
>
> Thomas
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: TEI - conTeXt
  2010-12-10 20:00   ` Jon Crump
@ 2010-12-10 20:40     ` Thomas Schmitz
  2010-12-11 19:56       ` Jon Crump
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Schmitz @ 2010-12-10 20:40 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Fri, 10 Dec 2010 12:00:59 -0800
  Jon Crump <jjcrump@uw.edu> wrote:

Jon,

OK, good to know. I'll need a bit more leisure to look at 
your example; here are just a few points:

processing an attribute with the 'xml:' namespace has been 
fixed by Hans very recently (last weekend), so if you 
haven't updated to the latest beta version, please do and 
try again; your syntax \xmlsetsetup{#1}{div[@xml:id='a']} 
is basically right.

Addressing content that has been set in xml anchors is 
possible, but not quite easy. I wouldn't have been able to 
figure it out without Hans. Just to show you an example: 
here's code that in my TEI document will fetch the content 
of a witness list:

\xmlfirst{#1}{root::/TEI/text/front/div[@type=='sigla']/listWit/witness[@xml:id==string.sub('\xmlatt{#1}{wit}',2)]}

The (for you) relevant part is "root::/": this is the 
topmost level of your TEI xml document. You then traverse 
all the elements and drill down to a <witness> element 
whose xml:id attribute is identical to the "wit" attribute 
of your current element. So <element wit="#foo"> will pick 
up the content of <witness xml:id="foo">bar</witness> and 
print "bar." This should get you going.

Last point: I don't want to sound negative, but what 
you're attempting is not straightforward and certainly not 
easy stuff. I am currently planning on doing a long-term 
project on editing texts in this manner, and I'm quite 
optimistic that all problems can eventually be solved. But 
if you need short-term solutions, a perfectly typeset 
edition within a matter of weeks, this may not be possible 
right away. E.g., I don't think we really have a solid 
framework yet for a bilingual edition as you envisage it. 
It is possible, but not easy, Hans needs the time and many 
test cases to make the code work. There is a research 
group here in Germany (with public funding) who are 
currently working on xml printing of material of exactly 
this type. I can assure you that for the time being, 
there's nothing out there which comes even close to 
ConTeXt in this area, but we're still at the beginning. 
So: if you want to help and test and be part of this, you 
are more than welcome, but none of us has a magic bullet; 
this is work in progress, not drop-in solutions.

All best

Thomas
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: TEI - conTeXt
  2010-12-10 20:40     ` Thomas Schmitz
@ 2010-12-11 19:56       ` Jon Crump
  2010-12-16  7:34         ` Thomas A. Schmitz
  0 siblings, 1 reply; 6+ messages in thread
From: Jon Crump @ 2010-12-11 19:56 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Fri, Dec 10, 2010 at 12:40 PM, Thomas Schmitz <tschmit1@uni-bonn.de> wrote:

> processing an attribute with the 'xml:' namespace has been fixed by Hans
> very recently (last weekend), so if you haven't updated to the latest beta
> version, please do and try again; your syntax
> \xmlsetsetup{#1}{div[@xml:id='a']} is basically right.

I've done as you suggest and downloaded the minimals beta leaving the
TeX-live distribution behind, so I can be on the same page with you
all. Hans's fix has worked. I'm gratified that my intuition about how
@xml:id should work was not wrong. The example in my last message now
works as expected.

> Addressing content that has been set in xml anchors is possible, but not
> quite easy. I wouldn't have been able to figure it out without Hans. Just to
> show you an example: here's code that in my TEI document will fetch the
> content of a witness list:
>
> \xmlfirst{#1}{root::/TEI/text/front/div[@type=='sigla']/listWit/witness[@xml:id==string.sub('\xmlatt{#1}{wit}',2)]}
>

This looks sensible to me. I'll see if I can't make it work with my
document next week. Thanks ever so much. Is that string substitution
function a bit of Lua?

> Last point: I don't want to sound negative, but what you're attempting is
> not straightforward and certainly not easy stuff. I am currently planning on
> doing a long-term project on editing texts in this manner, and I'm quite
> optimistic that all problems can eventually be solved. But if you need
> short-term solutions, a perfectly typeset edition within a matter of weeks,
> this may not be possible right away. E.g., I don't think we really have a
> solid framework yet for a bilingual edition as you envisage it. It is
> possible, but not easy, Hans needs the time and many test cases to make the
> code work. There is a research group here in Germany (with public funding)
> who are currently working on xml printing of material of exactly this type.
> I can assure you that for the time being, there's nothing out there which
> comes even close to ConTeXt in this area, but we're still at the beginning.
> So: if you want to help and test and be part of this, you are more than
> welcome, but none of us has a magic bullet; this is work in progress, not
> drop-in solutions.

Thomas, I do not take it in a negative way; simply practical. I take
seriously both the principle and practice of open-source endeavors
like ConTeXt, and the scholarly work it can support. I hope and intend
that as I get up to speed, I'll be able to make some small
contribution, even if it's only posting the commented example of our
project on the wiki. I've done some programming in Python, and am
rather keen to learn something about Lua, as they have quite a bit in
common. It's unlikely I'll be able to make substantive contributions
to the code, but not impossible in the fullness of time. I'm mindful
of the generosity of all involved, and all on this list, and offer
great thanks and kudos.

Your cautionary note on the bilingual edition is taken to heart, and I
have recommended that for the time being our project will not try to
implement a facing page translation. This remains an important
desideratum for us however, and I will attend with great interest your
progress, and the insights of any engaged in similar efforts. The
specific use-case we have in mind, and the problems associated with it
may be of interest to others and I'll post it on the wiki.
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: TEI - conTeXt
  2010-12-11 19:56       ` Jon Crump
@ 2010-12-16  7:34         ` Thomas A. Schmitz
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas A. Schmitz @ 2010-12-16  7:34 UTC (permalink / raw)
  To: mailing list for ConTeXt users


On Dec 11, 2010, at 8:56 PM, Jon Crump wrote:

> 
> I've done as you suggest and downloaded the minimals beta leaving the
> TeX-live distribution behind, so I can be on the same page with you
> all. Hans's fix has worked. I'm gratified that my intuition about how
> @xml:id should work was not wrong. The example in my last message now
> works as expected.
> 

If you want to try the latest and greatest, it's indeed better to work with the minimals. You can always keep texlive if you want to use other TeX stuff or if you want a stable fallback in case the latest beta breaks.

> 
> This looks sensible to me. I'll see if I can't make it work with my
> document next week. Thanks ever so much. Is that string substitution
> function a bit of Lua?
> 

Indeed, that's a lua function. It's extracting a substring (substitution would be string.gsub).

> 
> Thomas, I do not take it in a negative way; simply practical. I take
> seriously both the principle and practice of open-source endeavors
> like ConTeXt, and the scholarly work it can support. I hope and intend
> that as I get up to speed, I'll be able to make some small
> contribution, even if it's only posting the commented example of our
> project on the wiki. I've done some programming in Python, and am
> rather keen to learn something about Lua, as they have quite a bit in
> common. It's unlikely I'll be able to make substantive contributions
> to the code, but not impossible in the fullness of time. I'm mindful
> of the generosity of all involved, and all on this list, and offer
> great thanks and kudos.
> 
> Your cautionary note on the bilingual edition is taken to heart, and I
> have recommended that for the time being our project will not try to
> implement a facing page translation. This remains an important
> desideratum for us however, and I will attend with great interest your
> progress, and the insights of any engaged in similar efforts. The
> specific use-case we have in mind, and the problems associated with it
> may be of interest to others and I'll post it on the wiki.

Good, that's the spirit!

Thomas

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-12-16  7:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-09 23:20 TEI - conTeXt Jon Crump
2010-12-10 17:57 ` Thomas Schmitz
2010-12-10 20:00   ` Jon Crump
2010-12-10 20:40     ` Thomas Schmitz
2010-12-11 19:56       ` Jon Crump
2010-12-16  7:34         ` Thomas A. Schmitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).