xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "J.Pietschmann" <j3322...@yahoo.de>
Subject Re: Bulleted List
Date Sat, 10 Jul 2004 18:45:34 GMT
Varadharajan Sethuraman wrote:

> Hi,
>  
> I have one xml file like following
> <document>
>     <object type="nbullet">List1</object>
>     <object type="nbullet">List2</object>
>     <object type="nbullet">List3</object>
>     <object type="sbullet">List4</object>
>     <object type="sbullet">List5</object>
>     <object type="sbullet">List6</object>
>     <object type="nbullet">List7</object>
>     <object type="nbullet">List8</object>
> </document>
>  
> what i want is, the output(pdf) should be
>  
> 
>    1. List1
>    2. List2
>    3. List3
> 
>     * List4
>     * List5
>     * List6
> 
>    1. List7
>    2. List8
> 
> means .... if the type consecutive attributes of object is same then 
> preparing one list(nbullet the number bullet other symbols)
> 
> if you have any logic to implement this ....pls let me know ...

I suppose you are looking for hints on implementing this in
XSLT. You can try certain grouping techniques as described in
the XSL FAQ and on http://jenitennison.com, roughly
  <xsl:template match="document">
    <fo:list-block ...>
      <xsl:apply-templates
       select="(nbullet|sbullet)[not(preceding-sibling::*)
         or not(name(preceding-sibling::*[1])=name())]"/>
    </fo:list-block>
  </xsl:template>
  <xsl:template match="nbullet">
    <xsl:variable name="this" value="generate-id()"/>
    <xsl:for-each select="following-sibling::nbullet[
     not(preceding-sibling(sbullet) or
     generate-id(preceding-sibling::sbullet/
       following-sibling::nbullet[1])=$this)]">
      <fo:list-item>
        <fo:list-item-label ... ><xsl:value-of select="position()"
          /></fo:list-item-label>
        <fo:list-item-body ...>...</fo:list-item-body>
      </fo:list-item>
     </xsl:for-each>
  </xsl:template>
Add a similar template for sbullets. If you need display space between
the lists, add them conditionally in the appropriate templates.
Of course it would be much simpler if your XML was already properly
marked up, like
  <document>
    <list>
      <object type="nbullet">List1</object>
      <object type="nbullet">List2</object>
      <object type="nbullet">List3</object>
    </list>
    <list>
      <object type="sbullet">List4</object>
      <object type="sbullet">List5</object>
     ...
If you can change the XML, go this way first.
Please also note that XSLT questions are best asked on the XSL list
  http://www.mulberrytech.com/xsl/xsl-list/

J.Pietschmann



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Mime
View raw message