transforming a book for online use -- looking for linking advice

P

provowallis

I'm new to this board so I hope this reqest isn't out of line, but I'm
looking for some general advice about creating links in online books.
If the link target didn't involve PIs I don't think I'd be here, but
since it does, I'd be interested in getting some different perspectives
on this.

I have an XML book and I plan to create XHTML so I'm looking for the
best way to create links from the various components of the book to the
page break PIs.

The page break PIs look something like this: <?textpage page-no12?>

And I want to create a link to this spot from the other locations in
the book that cite the content on page 12. For example, I want to
create a link from the index entry that mentions page 12 to the page
break PI.

<index><index-entry>Turing,
Alan</index-entry><index-page-ref>12</index-page-ref></index-entry></index>

What's the best way to store the info in the data so I can build this
link when I run my transform?

I was thinking that I would have to add an ID value to my PI like so

<?textpage page-no_12 ID_0051243?>

and have a corresponding href on my index entry: <index-page-ref
href="0051243">12</index-page-ref>

Any advice greatly appreciated.








I
 
P

Peter Flynn

provowallis said:
I'm new to this board so I hope this reqest isn't out of line, but I'm
looking for some general advice about creating links in online books.
If the link target didn't involve PIs I don't think I'd be here, but
since it does, I'd be interested in getting some different perspectives
on this.

I have an XML book and I plan to create XHTML so I'm looking for the
best way to create links from the various components of the book to the
page break PIs.

The page break PIs look something like this: <?textpage page-no12?>

The first question with milestone markup like this is,
does the page 12 refer to the text following the PI, or preceding it?
In other words, does each PI mark the start or end of a page?
And I want to create a link to this spot from the other locations in
the book that cite the content on page 12. For example, I want to
create a link from the index entry that mentions page 12 to the page
break PI.

<index><index-entry>Turing,
Alan</index-entry><index-page-ref>12</index-page-ref></index-entry></index>

That's not well-formed: there's a spurious said:
What's the best way to store the info in the data so I can build this
link when I run my transform?

I was thinking that I would have to add an ID value to my PI like so

<?textpage page-no_12 ID_0051243?>

The values in the content of a PI have no predefined semantics,
and are not parseable, so "ID" is without meaning.
and have a corresponding href on my index entry: <index-page-ref
href="0051243">12</index-page-ref>

Assuming for the moment that the pagebreak PIs mark the tops of the
pages, this template

<xsl:template match="processing-instruction('textpage')">
<a name="{.}"></a>
</xsl:template>

will create a target for your links. The template:

<xsl:template match="index-page-ref">
<a
href="#{//processing-instruction()[substring-after(.,'_')=current()/.]}">
<xsl:apply-templates/>
</a>
</xsl:template>

will create an anchor element pointing to the right target, eg if
you leave the PIs as they were (no ID, just page-no_nnn), you get

<a name="page-no_12"></a>

as the output of the PI template, and

<a href="#page-no_12">12</a>

as the output of the index-page-ref template.

///Peter
 
P

Peter Flynn

provowallis said:
I'm new to this board so I hope this reqest isn't out of line, but I'm
looking for some general advice about creating links in online books.
If the link target didn't involve PIs I don't think I'd be here, but
since it does, I'd be interested in getting some different perspectives
on this.

I have an XML book and I plan to create XHTML

This is, incidentally, one reason I never use XSL for generating my PDF.
Using XSLT to LaTeX allows me to generate far better quality, and use
tools like makeindex and bibtex. For indexing an online version, which
doesn't have "pages" in the same sense, I link to the element which
triggered the index entry in the first place, rather than try to make it
look like a page-based document.

Have a look at http://research.silmaril.ie/latex to see an example of
this (complete with bugs: it's due for an update).

///Peter
 
J

Joe Kesselman

Peter said:
This is, incidentally, one reason I never use XSL for generating my PDF.

XSLT turned out to be a far more general, popular, and successful tool
than anyone expected... and, unfortunately, we haven't gotten much
buy-in for XSL-FO renderers in browsers and so on. I'm still hoping that
XSL-FO will someday replace HTML (or be how XHTML is rendered), but I'm
not holding my breath.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top