468,505 Members | 1,772 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,505 developers. It's quick & easy.

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

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

Oct 21 '06 #1
3 1365
provowallis wrote:
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 </index-entryin there.
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
--
XML FAQ: http://xml.silmaril.ie/
Oct 26 '06 #2
provowallis wrote:
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
Oct 26 '06 #3
Peter Flynn wrote:
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.
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Oct 26 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Alexander Rippert | last post: by
4 posts views Thread by Simon Cooke | last post: by
35 posts views Thread by Markus Dreyer | last post: by
4 posts views Thread by Hayato Iriumi | last post: by
2 posts views Thread by Water Cooler v2 | last post: by
1 post views Thread by Billy Biro | last post: by
3 posts views Thread by mesut | last post: by
1 post views Thread by tragomaskhalos | last post: by
reply views Thread by NPC403 | last post: by
3 posts views Thread by gieforce | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.