Hi all,
Maybe it's worth mentioning that we developed some XSLT templates + CSS
rules for rendering the example snippets in TEI By Example (see e.g.
<http://teibyexample.org/>). Currently, the XSLT (nor XQuery) sources
are accessible, though maybe it's something we should consider adding in
the future...
On 30/10/2011 17:37, Sebastian Rahtz wrote:
> On 30 Oct 2011, at 15:14, Martin Holmes wrote:
>> Yours is wonderfully sophisticated -- there are definitely some things I
>> need to incorporate into mine from yours, such as namespace prefixes,
>> which I hadn't really thought about.
> the other things to think about are rewrapping text, and doing inline
> markup where<hi>possible</hi>. I use mine a lot for teaching,
> where it is important not to use up too much space on slides.
>
> I spent a _long_ time fighting namespaces and prefixes
> and declarations. It's not easy to know what to do, especially
> when you target static formats like PDF or docx.
Regarding the two issues pointed out in this thread, this is how we did it:
-namespaces: only those namespace declarations are copied that
aren't already present in the parent element (meaning that only new
namespace declarations are copied on the nodes they are declared on)
-inline elements: an element is determined to be inline if:
-there are more element siblings than non-empty text siblings
-and the first preceding or following sibling text element
doesn't end, resp. start with non-whitespace
...or in XPath:
count(parent::*/*)> count(parent::*/text()[normalize-space() != ''])
and
not(preceding-sibling::node()[1][self::text()[matches(., '\S$')]]|following-sibling::node()[1][self::text()[matches(., '^\S')]])
For example example renderings:
-see e.g.
<http://tbe.kantl.be/TBE/modules/TBED01v00.htm#generalsummary>
-enter e.g. following XML fragment in the TBE validator
(<http://tbe.kantl.be/TBE/xquery/TBEvalidator.xq>):
<egXML xmlns="http://www.tei-c.org/ns/Examples">
<el xmlns="test">
<el2 xmlns:test="test" xmlns:que="que">this will be computed as inline content
<test:el3 xmlns:test="test">text with an inline<el>element</el>, surrounded with more text</test:el3>
</el2>
<el2 xmlns:test="test" xmlns:que="que">this will be computed as block content, since 2 elements> 1 text() node
<test:el3 xmlns:test="test">text with an inline<el>element</el>, surrounded with more text</test:el3>
<test:el3 xmlns:test="test">text<el>with</el> more<el>inline</el> <el>element nodes</el> <el>than</el> non-empty text</test:el3>
</el2>
</el>
</egXML>
Ron
--
Ron Van den Branden
Wetenschappelijk attaché / Senior Researcher
Reviews Editor LLC. The Journal of Digital Scholarship in the Humanities
Centrum voor Teksteditie en Bronnenstudie - CTB (KANTL)
Centre for Scholarly Editing and Document Studies
Koninklijke Academie voor Nederlandse Taal- en Letterkunde
Royal Academy of Dutch Language and Literature
Koningstraat 18 / b-9000 Gent / Belgium
tel: +32 9 265 93 51 / fax: +32 9 265 93 49
E-mail : [log in to unmask]
http://www.kantl.be/ctb
|