OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] Re: html navigation <link> elements


Hi Sam,
You can use something like this:

<xsl:variable name="faq.target" select="key('id', 'faq-help')"/>

 <link rel="help">
  <xsl:attribute name="href">
     <xsl:call-template name="href.target">
        <xsl:with-param name="object" select="$faq.target"/>
     </xsl:call-template>
  </xsl:attribute>
  <xsl:attribute name="title">
    <xsl:variable name="question.content">
      <xsl:apply-templates select="$faq.target/question/node()"/>
    </xsl:variable>
    <xsl:value-of select="$question.content"/>
  </xsl:attribute>
 </link>

You use a template body to generate the value of each attribute.  The 
faq.target variable selects the node in the document whose id is 
'faq-help', using an XSL key that is created by the stylesheet named 'id' 
for that purpose.

That node is then processed by the template named 'href.target' which 
generates the URL for it.

The title is a bit trickier, because the target element is a qandaentry, 
and you just want the question text.  For most elements, you could process 
the target in mode="xref-to" which generates the xref text.  For a 
qandaentry it generates the question number instead of the text.  You have 
to process the question child, but you don't want to process that element 
because it will generate <p> paragraph tags.  Instead, you select the 
content of question (all node()s).  Since this is going into an attribute, 
you put the result into a variable and then take the value of the variable, 
which converts it to a string to remove any markup that might be in the 
question.

Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobs@sagehill.net


----- Original Message ----- 
From: "Sam Steingold" <sds@podval.org>
To: <docbook-apps@lists.oasis-open.org>
Sent: Monday, May 08, 2006 9:31 AM
Subject: [docbook-apps] Re: html navigation <link> elements


> Hi Bob,
>
>> * Bob Stayton <obof@fntruvyy.arg> [2006-05-08 09:14:54 -0700]:
>>
>>> suppose "http://clisp.cons.org/impnotes/faq.html#faq-help";
>>> has id "faq-help" in the docbook/xml document being processed, how do I
>>> refer to it in the <link> above?
>>
>> How do you put an id on a quoted string?  Is that string in a ulink with
>> an id attribute?  An example would help.
>
> my docbook/xml document contains these elements :
>
> <index id="idx"/>
> <qandaentry id="faq-help"> ...
> &c
>
> when I convert it to HTML, I want the <html><head> element to contain
> the following elements:
>
> <link rel="help" title="How do I ask for help?" 
> href="faq.html#faq-help"/>
> <link rel="contents" title="Index" href="idx.html"/>
>
> to that end, I added the following template to my xsl customization 
> layer:
>
>
> <xsl:template name="user.head.content">
> <meta name="date">
>  <xsl:attribute name="content"><xsl:call-template name="datetime.format">
>    <xsl:with-param name="date" select="date-time()"/>
>    <xsl:with-param name="format" select="'regenerated: x'"/>
> </xsl:call-template></xsl:attribute></meta>
> <link rel="help" title="How do I ask for help?" 
> href="faq.html#faq-help"/>
> <link rel="home" title="Home" href="http://clisp.cons.org"/>
> <link rel="contents" title="Table of Contents" href="index.html"/>
> <link rel="contents" title="Index" href="idx.html"/>
> </xsl:template>
>
>
> it works as intended (after I remove the <meta> element which does does
> not work because "date-time" and "date:date-time" are not defined, see
> http://article.gmane.org/gmane.text.docbook.apps:15096)
>
> now, I would like to be able to replace href="idx.html" and
> href="faq.html#faq-help" with something like href="f(idx)" and
> href="f(faq-html)" where f() is a function that computes the anchor/id
> of the html element into which the docbook element with the
> corresponding id is mapped.
>
> thanks.
>
> PS. Bob, please configure your MUA to respect the header
>    "Mail-Copies-To: never" (I do not want mail-copies of replies, I
>    read this list on gmane).  Thanks.
>
> -- 
> Sam Steingold (http://www.podval.org/~sds) on Fedora Core release 5 
> (Bordeaux)
> http://thereligionofpeace.com http://truepeace.org http://jihadwatch.org
> http://honestreporting.com http://camera.org http://pmw.org.il 
> http://memri.org
> When C++ is your hammer, everything looks like a thumb.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
>
>
> 




[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]