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

Discussion in 'XML' started by provowallis, Oct 21, 2006.

  1. provowallis

    provowallis Guest

    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
     
    provowallis, Oct 21, 2006
    #1
    1. Advertising

  2. provowallis

    Peter Flynn Guest

    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/
     
    Peter Flynn, Oct 26, 2006
    #2
    1. Advertising

  3. provowallis

    Peter Flynn Guest

    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
     
    Peter Flynn, Oct 27, 2006
    #3
  4. 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
     
    Joe Kesselman, Oct 27, 2006
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kirok
    Replies:
    2
    Views:
    350
    Kirok
    Nov 10, 2005
  2. nani
    Replies:
    0
    Views:
    396
  3. chinni
    Replies:
    0
    Views:
    397
    chinni
    Nov 20, 2009
  4. Casey Hawthorne
    Replies:
    14
    Views:
    448
  5. arjun-w
    Replies:
    0
    Views:
    296
    arjun-w
    Sep 27, 2013
Loading...

Share This Page