473,394 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

XML/XSL TEI Footnote questions

Hello,

I have several books written up in TEI with long footnotes/endnotes.
The notes often contain multiple paragraphs or lines of poems etc. It
seems perfectly legal in TEI to do the following:

<p>Some paragraph text.
<note place="foot">
<p>This note is long.</p>
<p>see, I told you it was long</p>
</note></p>

The question is then how do I process this efficiently in XSL(T)? The
documents typically have multiple div levels etc.

Typically I've set up templates in my XSL (to convert to wordml) like:

<xsl:template match="p">
<w:p>
<w:r>
<w:t>
<xsl:value-of select="."/>
</w:t>
</w:r>
<xsl:apply-templates select="note"/>
</w:p>
</xsl:template>
<xsl:template match="note">
<w:r>
<w:rPr>
<w:rStyle w:val="FootnoteReference"/>
</w:rPr>
<w:footnote>
<w:p>
<w:pPr>
<w:pStyle w:val="FootnoteText"/>
</w:pPr>
<w:r>
<w:rPr>
<w:rStyle w:val="FootnoteReference"/>
</w:rPr>
<w:footnoteRef/>
</w:r>
<w:r>
<w:t>
<xsl:value-of select="."/>
</w:t>
</w:r>
</w:p>
</w:footnote>
</w:r>
</xsl:template>
This works ok, but it produces duplicate text for footnotes: like

<w:r>
<w:t>Some paragraph text.This note is long.
see, I told you it was long</w:t>
</w:r>
<w:r>
<w:rPr>
<w:rStyle w:val="FootnoteReference"/>
</w:rPr>
<w:footnote>
<w:p>
<w:pPr>
<w:pStyle w:val="FootnoteText"/>
</w:pPr>
<w:r>
<w:rPr>
<w:rStyle w:val="FootnoteReference"/>
</w:rPr>
<w:footnoteRef/>
</w:r>
<w:r>
<w:t>This note is long.see, I told you it was long</w:t>
</w:r>
</w:p>
</w:footnote>
</w:r>

So they are not quite formatted the way I'd like!

Any suggestions would be helpful.

Thank you,

Jeremy

Mar 16 '06 #1
4 2158
Jeremy Porter wrote:
Hello,

I have several books written up in TEI with long footnotes/endnotes.
The notes often contain multiple paragraphs or lines of poems etc. It
seems perfectly legal in TEI to do the following:

<p>Some paragraph text.
<note place="foot">
<p>This note is long.</p>
<p>see, I told you it was long</p>
</note></p>
Yes, except I'd use <p>Some paragraph text.<note place="foot">
with no white-space after the period. Otherwise if the end of the
sentence happens by chance to fall at a suitable line-end point,
the formatter might use the white-space as a signal that it's OK
to break the line there...and then put the footnote reference
mark at the start of the next line :-)
The question is then how do I process this efficiently in XSL(T)? The
documents typically have multiple div levels etc.


I'll leave the WordML problem to someone who knows Word better than
I do.

When outputting to a pageless model (eg HTML), the technique is to
insert just the footnote marks when you encounter the footnote, and
then at the change of div, test for any footnotes in the preceding
chunk, which will be either the previous div at the same level, or the
material at the start of a div which precedes the first div; and
process them at that point using a named template.

For example, assuming div0 itself contains just metadata/head:

template div1
apply-templates
do-footnotes from last div2 of this div1

template div2
if first div2 in this div1
do-footnotes in preceding-sibling::*
apply-templates
do-footnotes from last div3 of this div2

similarly for div3/4/5/6/7

template named do-footnotes
use param for context
calculate the counter-start
for-each through the the footnotes

This way the footnotes come out at a suitable breakpoint, and are
never too far from the point of reference. It works fine with HTML:
as I don't know Word's internal footnoting mechanism I can't say
if it would apply there.

///Peter
--
XML FAQ: http://xml.silmaril.ie/
Mar 16 '06 #2
SL
"Jeremy Porter" a écrit :
Hello,

I have several books written up in TEI with long footnotes/endnotes.
The notes often contain multiple paragraphs or lines of poems etc. It
seems perfectly legal in TEI to do the following:

<p>Some paragraph text.
<note place="foot">
<p>This note is long.</p>
<p>see, I told you it was long</p>
</note></p>

The question is then how do I process this efficiently in XSL(T)? The
documents typically have multiple div levels etc.

Typically I've set up templates in my XSL (to convert to wordml) like:

<xsl:template match="p">
<w:p>
<w:r>
<w:t>
<xsl:value-of select="."/>
</w:t>
</w:r>
<xsl:apply-templates select="note"/>
</w:p>
</xsl:template>


With this value-of, the text of the note is selected, since value-of
create a concatenation of all the text nodes descending from the
current node. So the text of the note is include a first time in the
paragraphe template, and then a second time in your "note" template.

For a fix you may consider using <xsl:apply-templates /> instead of
<xsl:value-of select="." /> in your "p" template, make a template
producing nothing for the "note" element (so that it does not output
its text content when walking through the tree), and use a named
template instead of <xsl:apply-templates select="note" />. I'm not
sure to be clear nor to have corectly understand your problem :-)

The TEI is complex to process. Have you consider using the TEI
stylesheet on the TEI web site ?

See http://www.tei-c.org/Stylesheets/teic/

And sourceforge
(http://sourceforge.net/project/showf...roup_id=106328) for
downloading the stylesheets. Output in HTML, XSL-FO or latex. Perhaps
it's simpler to convert your document in HTML and import the file in
Word.

Mar 18 '06 #3
Thanks for the replies. I have considered the TEI stylesheets and do
use them for HTML/XSL:FO, but they do not convert to WordProcessingML
and even if I convert to XSL:FO then what? It seems that most FO
processors are either very expensive or in their infancy in their
ability to produce pdf documents. I really need printable pdf documents
out of my TEI xml documents.

Peter, you wrote out some nice logic statements in your post--any idea
where I might get a good overview of XSL(T) Programing Paradigms? I
read about a few different things on the internet but they seemed not
quite in scope with what I want. I would like to find a method similar
to say database normalization or object oriented design--something that
you can follow when I start to write up my XSL for this.

I think I will start with the existing TEI stylesheets. What I would
like to do is use the existing XSL:FO sheets for TEI to create
WordProcessingML sheets. I'm sure there will be some translation in
what they do, but I bet I can handle that if I can just all the
language details down.

Thanks!

Jeremy

Mar 19 '06 #4
SL
"Jeremy Porter" a écrit :
Thanks for the replies. I have considered the TEI stylesheets and do
use them for HTML/XSL:FO, but they do not convert to
WordProcessingML and even if I convert to XSL:FO then what? It seems
that most FO processors are either very expensive or in their
infancy in their ability to produce pdf documents.
Yes, it seems. There is a new FOP version (I haven't used) claming to
be more complete. If you use a restricted set of FO objects it may be
sufficient ?

Note that you can indicate the intended target FO engine in the
stylesheet (in stylesheet/fo/tei-param.xsl) :

<xd:doc type="string" class="output">
<xd:short>Name of intended XSL FO engine</xd:short>
<xd:detail>This is used to tailor the result for different XSL FO processors.
By default, no special measures are taken, so
there are no bookmarks or other such features. Possible values are
<ul>
<li>passivetex (the TeX-based PassiveTeX processor</li>
<li>xep (XEP)</li>
<li>fop (FOP)</li>
<li>antenna (Antenna House)</li>
</ul>
</xd:detail>
</xd:doc>
<xsl:param name="foEngine">fop</xsl:param>
I really need printable pdf documents out of my TEI xml documents.
There is also the possibility of using TEI->latex stylesheet, but I
have never used them.

But you may consider too converting your TEI files into HTML and
import this HTML file into Word.
I think I will start with the existing TEI stylesheets.


Looks reasonable :-)

Mar 19 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: gsb | last post by:
HOW TO: Submit a form to PHP with no return? I need to submit a form for file upload to a PHP script but do not want anything returned. That is the TARGET for the form should be like a null...
55
by: James A. Donald | last post by:
In a book, a footnote is presented at the bottom of the page, in a slightly smaller type. converting a book to html, pages are bottomless, so we can put the footnote in a separate link, or...
0
by: Jacky11 | last post by:
Hi everyone, I have spent several hours on this topic, and I still don't have the right solution. However, you guys can accomplish in 5 minutes much more then I can accomplish in 5 hours. :-)...
0
by: softwareengineer2006 | last post by:
All Interview Questions And Answers 10000 Interview Questions And Answers(C,C++,JAVA,DOTNET,Oracle,SAP) I have listed over 10000 interview questions asked in interview/placement test papers for...
0
by: Byomokesh | last post by:
Hi, I have problem facing in Linking Tags. Linking are 3 types. <!-- Just remark Id --> :( 1. Pref02fn1 <!-- This footnote text move to paragraph in place of link tags. --> 2....
0
by: connectrajesh | last post by:
INTERVIEWINFO.NET http://www.interviewinfo.net FREE WEB SITE AND SERVICE FOR JOB SEEKERS /FRESH GRADUATES NO ADVERTISEMENT
2
by: freepdfforjobs | last post by:
Full eBook with 4000 C#, JAVA,.NET and SQL Server Interview questions http://www.questpond.com/SampleInterviewQuestionBook.zip Download the JAVA , .NET and SQL Server interview sheet and rate...
4
by: Drew | last post by:
I posted this to the asp.db group, but it doesn't look like there is much activity on there, also I noticed that there are a bunch of posts on here pertaining to database and asp. Sorry for...
8
by: Krypto | last post by:
Hi, I have used Python for a couple of projects last year and I found it extremely useful. I could write two middle size projects in 2-3 months (part time). Right now I am a bit rusty and trying...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.