[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Moving examples around in output


Subject: Re: [xsl] Moving examples around in output
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 23 Mar 2007 12:12:28 -0400

Jackie,

To collect all the examples (or let's say examplegp elements) in the document, you'd use an XPath traversing from the document root.

So in your case,

... At 11:58 AM 3/23/2007, you wrote:

 <xsl:template match="/field">
   <fo:block font-size="10pt" text-align="justify">
            <xsl:apply-templates
                select="definition | guidelines"/>
            <xsl:call-template name="examplesec"/>
        </fo:block>
    </xsl:template>

At <examplesec> you have:

 <xsl:template name="examplesec">
<fo:block text-decoration="underline">
<xsl:text>Examples</xsl:text>
<xsl:apply-templates select="examplegp" mode="section"/>
^^^^^^^^^
The context for this select expression is the same as the context where the named template examplesec was called. Since "/field" (presumably) has no examplesec elements, you're not getting any.


To compensate for this, you want

<xsl:apply-templates select="//examplegp" mode="section"/>

As you may recall, '//examplegp' is short for

/descendant-or-self::node()/child::examplegp

... which traverses from the root of the document. (Starting with the '/' makes it an absolute path.)

You could also use "/descendant::examplegp" if you prefer being clear to being concise, or an expression such as "./descendant::examplegp" or ".//examplegp" to get all the examplegp elements under the field element (the context).

Cheers,
Wendell



======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


Current Thread
Keywords