[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Grouping: XHTML inline, block and flow

Subject: Re: Grouping: XHTML inline, block and flow
From: "Raka Gator" <plogbil@xxxxxxxxx>
Date: Thu, 27 Mar 2008 16:21:49 +0100
Re:  Grouping: XHTML inline
Hi!

On Thu, Mar 27, 2008 at 4:13 PM, Bjorndahl, Brad
<brad.bjorndahl@xxxxxxxxxxxxxxxx> wrote:
>  I can only respond to question 1. I have done something similar with DITA, which also allows a mix of inline and block type elements.
>
>  First, though, I would not try to solve this problem in full generality without XSLT 2.0. I'm just not brave enough.

Yeah, I've realized that I should go with 2.0. I'm going to give it a try.

>  Assuming you have resolved your problems with 2.0, this is how I handle the mix:
>
>  1) Specify your inline elements in a global variable like this:
>  <xsl:variable name="inlineElts">
>   <inline></inline> <!-- for text nodes -->
>   <inline>b</inline>
>   <inline>i</inline>
>   <inline>sup</inline>
>   <inline>sub</inline>
>   .
>   .
>   .
>  </xsl:variable>
>
>
>  2) In templates that process mixed content, include, at the appropriate point:
>  <xsl:call-template name="processMixedContent" >
>  .
>  </xsl:call-template>
>
>  In my case I also have
>  <xsl:call-template name="processNodes-note" >
>  <xsl:call-template name="processNodes-li_choice_dt" >
>  and so on for special cases, but they all work in a similar way.
>
>
>  3) Add the processMixedContent template:
>  <xsl:template name="processMixedContent"> . . .
>
>  in which you have a statement that groups inline and block elements like this (and this is where 2.0 is important):
>
>   <xsl:for-each-group select="child::node()" group-adjacent="exists(index-of($inlineElts/inline,local-name()))">
>     <xsl:for-each select=".">
>       <xsl:choose>
>         <xsl:when test="current-grouping-key() eq true()"> <!-- Process inline elements  -->
>           <xsl:for-each select="current-group()" >
>         .
>         .
>         .
>         <xsl:otherwise> <!-- Process block elements  -->
>
>            <xsl:apply-templates select="current-group()">

Great tip! I didn't even know that you could do that with variables.
I'll read up on
2.0 grouping and try to solve the other issues and give it a try!
Thank you very much!

/Stefan

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.