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: XSL customization

On Sun, Apr 27, 2003 at 02:08:39AM -0400, Sam Steingold wrote:
> > * In message <20030425203938.A15096@sco.com>
> > * On the subject of "Re: XSL customization"
> > * Sent on Fri, 25 Apr 2003 20:39:39 -0700
> > * Honorable Bob Stayton <bobs@sco.com> writes:
> >
> > See this doc:
> > http://www.sagehill.net/xml/docbookxsl/CustomMethods.html
> thanks, this was quite useful!
> more questions in the order of increasing complexity:
> 1. how do I append to a parameter?  I don't want to list all the stuff
>    in generate.toc all other again, so I tried
> <xsl:param name="generate.toc">
>  refentry  toc
>  $generate.toc
> </xsl:param>
>    with no success.

XSL does not allow variable values to be modified once
they are set in a given scope.  It is one of the first
things you learn when writing XSL, and it takes some
getting used to.  You pretty much
have to keep the whole list in your customization.

> 2. I want <literal role="foo">...</literal> to transform to
>    <tt role="foo">...</tt>.
> <xsl:template match="literal[@role = 'type' or @role = 'sexp']">
>  <tt role="@role"><xsl:apply-templates/></tt>
> </xsl:template>
>    does not work

Look up Attribute Value Template in your XSL reference.
You need to use this syntax:
<tt role="{@role}"><xsl:apply-templates/></tt>

> 3. I want <emphasis role="strong">...<emphasis> to transform to
>    <strong>...</strong>
> <xsl:template match="emphasis[@role = 'strong']">
>  <strong><xsl:apply-templates/></strong>
> </xsl:template>
>    does not work either

Works for me.  What do you get?

> 4. if a varlistentry has several term elements, I want them to be
>    separated by a line break, not ", ".  DSSSL:
> (element (varlistentry term)
>   (make sequence
>     (process-children-trim)
>     (if (not (last-sibling?))
> 	(make empty-element gi: "BR")
> 	(literal ""))))
>    XSL??

You need to customize this template in html/lists.xsl:

<xsl:template match="varlistentry/term">
  <span class="term">
    <xsl:call-template name="anchor"/>
    <xsl:text>, </xsl:text>

    <xsl:text>, </xsl:text>

There is another template with priority="2" that
handles the last term, so you don't get a <br>
after every one.

> 5. Is there a way to insert comments into the __output__ files?
>    Ideally, I want to preserve comments in the input file, but, IIUC,
>    they are not available to the XSLT processor.
>    So, I would need to find an element which may occur at any place
>    (like a comment can!) and create a template to translate it into a
>    comment (for further non-XSLT processing).

Comments are available to the XSLT processor, matched with
a node type expression comment(), which is not a function
even though it looks like one.  This template will pass through
your comments:

<xsl:template match="comment()">
  <xsl:comment><xsl:value-of select="."/></xsl:comment>

You might want to get a good XSLT reference to help with
some of these syntax issues.  I use Micheal Kay's
XSLT Programmer's Reference (2nd ed.).


Bob Stayton                                 400 Encinal Street
Publications Architect                      Santa Cruz, CA  95060
Technical Publications                      voice: (831) 427-7796
The SCO Group                               fax:   (831) 429-1887
                                            email: bobs@sco.com

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