docbook-apps

  • 1.  Re: xsl:call-template: misplaced xsl:apply-imports

    Posted 10-15-2007 21:52
    Hi Sam,
    As you found out, the body of a xsl:call-template can only take
    xsl:with-param children, not any other content such as that generated by
    xsl:apply-imports.

    The basic problem is that this template:

    <xsl:template match="link" name="link">

    was not written to accept the hot text as a parameter. Instead, you should
    look at the template named "simple.xlink" which is used by the "link"
    template. The "simple.xlink" templates takes both linkend and content
    parameters. Put the apply-imports into the content parameter.

    Bob Stayton
    Sagehill Enterprises
    DocBook Consulting
    bobs@sagehill.net


    ----- Original Message -----
    From: "Sam Steingold" <sds@gnu.org>
    To: "DocBook Apps" <docbook-apps@lists.oasis-open.org>
    Cc: "Bob Stayton" <bobs@sagehill.net>
    Sent: Monday, October 15, 2007 11:31 AM
    Subject: xsl:call-template: misplaced xsl:apply-imports


    >I want
    > <filename role="module">queens</filename>
    > to be converted to
    >
    >
    > [whatever docbook wants to format filenames with]queens[/]
    >

    >
    > while
    > <filename role="module" path="rasock-mod">rawsock</filename>
    > to be converted to
    >
    >
    > [whatever docbook converts the following]
    > <filename>rawsock</filename>
    > or (whatever is easier)
    > <filename>rawsock</filename>
    > [/]
    >

    >
    > I.e., then path= is supplied, it is used as a link into the current
    > document, otherwise an external link into the CVS should be generated.
    >
    > so far I came up with
    >
    > <xsl:param name="clisp.cvs.top"
    > select="'http://clisp.cvs.sourceforge.net/*checkout*/clisp/clisp/'"/>
    > <xsl:template match="filename[@role='module']">
    > <xsl:message>Module [<xsl:value-of select="."/>] path=[<xsl:value-of
    > select="@path"/>]:</xsl:message>
    >
    > <xsl:choose><xsl:when test="@path"><xsl:call-template name="link">
    > <xsl:with-param name="linkend" select="@path"/><xsl:apply-imports/>
    > </xsl:call-template></xsl:when>
    > <xsl:otherwise>
    > <xsl:apply-imports/>
    </xsl:otherwise></xsl:choose>

    > </xsl:template>
    >
    > so far the "cvs" ("otherwise") part appears to work, but the "link" part
    > ("when") is broken: I get these messages:
    >
    > Module [rawsock] path=[rawsock]:
    > xsl:call-template: misplaced xsl:apply-imports
    > Module [fastcgi] path=[fastcgi]:
    > xsl:call-template: misplaced xsl:apply-imports
    >
    > if I follow
    > http://www.sagehill.net/docbookxsl/AddNewTemplate.html#AddProcessingSteps
    > and take <xsl:apply-imports/> _outside_ of <xsl:call-template
    > name="link">, I get the text ("gdbm") appear twice in the output: first
    > time formatted as a link and the second time formatted as a pathname,
    > instead of _once_ formatted both as a filename ()
    > _and_ a link in the document.
    >
    > please help!
    > thanks!
    > Sam.
    >
    > PS. Bob, this is my 3rd attempt to send the message to the mailing list
    > in the last day, I do not see the first 2 messages on the list, and no
    > rejection or error messages, so I am lost. If you could be so kind to
    > reply to this message on the list, it would be very nice of you! Thanks!
    >
    >





  • 2.  Re: xsl:call-template: misplaced xsl:apply-imports

    Posted 10-16-2007 01:24
    Hi Bob, thanks for your kind reply!

    Bob Stayton wrote:
    > As you found out, the body of a xsl:call-template can only take
    > xsl:with-param children, not any other content such as that generated by
    > xsl:apply-imports.
    >
    > The basic problem is that this template:
    >
    > <xsl:template match="link" name="link">
    >
    > was not written to accept the hot text as a parameter. Instead, you
    > should look at the template named "simple.xlink" which is used by the
    > "link" template. The "simple.xlink" templates takes both linkend and
    > content parameters. Put the apply-imports into the content parameter.

    I thought about it, but <xsl:template match="link" name="link"> does
    some fairly complicated content processing which I am reluctant to
    replicate.
    maybe it is possible to abstract it out so that I can use it in my
    customizations?
    Thanks!

    Sam.