Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > transforming a book for online use -- looking for linking advice

Reply
Thread Tools

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

 
 
provowallis
Guest
Posts: n/a
 
      10-21-2006
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

 
Reply With Quote
 
 
 
 
Peter Flynn
Guest
Posts: n/a
 
      10-26-2006
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-entry> in 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/
 
Reply With Quote
 
 
 
 
Peter Flynn
Guest
Posts: n/a
 
      10-26-2006
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
 
Reply With Quote
 
Joe Kesselman
Guest
Posts: n/a
 
      10-27-2006
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Book: Higher-Order Perl: Transforming Programs with Programs Casey Hawthorne Perl Misc 14 07-14-2005 06:43 PM
Data Recovery Book and Online Business Promotion, Products Sales Promotion, Search Engine Optimization and Online Data Recovery Training services Author Tarun Tyagi Cisco 0 12-15-2004 01:52 AM



Advertisments