xsl-list
[Top] [All Lists]

Re: [xsl] Moving examples around in output

2007-03-23 09:13:32
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(_at_)mulberrytech(_dot_)com
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
======================================================================


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>