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

Re: A grouping question ?

Subject: Re: A grouping question ?
From: Mukul Gandhi <mukulgw3@xxxxxxxxx>
Date: Sat, 1 Nov 2003 20:21:34 -0800 (PST)
utf 8 bullet
Hi Emilio,

Here is another XSL, solving the problem --

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan">
<xsl:output method="html" version="1.0"
encoding="UTF-8" indent="yes"/>
<xsl:template match="/Content">
  <html>
    <xsl:for-each select="Paragraph">
	<xsl:if test="@bullet = 'false'">
	  <p>
	    <xsl:value-of select="Text/@txt"/>
  	  </p>
        </xsl:if>
	<xsl:if test="((@bullet = 'true') and
(preceding-sibling::Paragraph[1][@bullet = 'false']))
">
	   <ul>
	     <li>
		<xsl:value-of select="Text/@txt"/>
	     </li>
	     <xsl:call-template name="print-li-tags">
		 <xsl:with-param name="xml-subset"
select="following-sibling::Paragraph"/>
	     </xsl:call-template>
	   </ul>
         </xsl:if>
      </xsl:for-each>
  </html>	
</xsl:template>
	
<xsl:template name="print-li-tags">
   <xsl:param name="xml-subset"/>
     <xsl:if test="$xml-subset[1][@bullet = 'true']">
       <li>
	  <xsl:value-of select="$xml-subset[1]/Text/@txt"/>
       </li>
     </xsl:if>

     <xsl:variable name="ns">
	<xsl:for-each select="$xml-subset[position() &gt;
1]">
	   <Paragraph bullet="{@bullet}">
	      <xsl:value-of
select="xml-subset[1]/Text/@txt"/>
            </Paragraph>
 	</xsl:for-each>
     </xsl:variable>
		
     <xsl:for-each
select="xalan:nodeset($ns)/Parapgarh">
	<xsl:if test="(position() = 1) and (@bullet =
'false')">
	  <p>
	    <xsl:value-of select="Text/@txt"/>
	  </p>
	  <xsl:call-template name="print-li-tags">
	    <xsl:with-param name="xml-subset"
select="xalan:nodeset($ns)/Paragraph[position() &gt;
1]"/>
	  </xsl:call-template>
        </xsl:if>
      </xsl:for-each>
	
   </xsl:template>
</xsl:stylesheet>


Regards,
Mukul

--- Emilio_Gustavo_Ormeño <eormeno@xxxxxxxxxxxxxxxxx>
wrote:
> Hi, I don't know if this is a grouping question, but
> given than I don't 
> know the way to solve it. I need your help. This is
> my problem:
> 
> I have a XML file such as:
> 
> <Content>
>     <Paragraph bullet='false'>
>         <Text txt='Hello World'/>
>     </Paragraph>
>     <Paragraph bullet='true'>
>         <Text txt='First Bulleted Hello World'/>
>     </Paragraph>
>     <Paragraph bullet='true'>
>         <Text txt='Second Bulleted Hello World'/>
>     </Paragraph>
>     <Paragraph bullet='false'>
>         <Text txt='A normal line of text'/>
>     </Paragraph>
>     <Paragraph bullet='true'>
>         <Text txt='Another bulleted line'/>
>     </Paragraph>
>     <Paragraph bullet='true'>
>         <Text txt='A second bulleted line'/>
>     </Paragraph>
> </Content>   
> 
> And I want an HTML output like the following:
> 
> <html>
>     <p>Hello World</p>
>     <ul>
>         <li>First Bulleted Hello World</li>
>         <li>Second Bulleted Hello World</li>
>     </ul>
>     <p>A normal line of text</p>
>     <ul>
>         <li>Another bulleted line</li>
>         <li>A second bulleted line</li>
>     </ul>
> </html>
> 
> I thought that it was a grouping problem, but when I
> tried to solve it, 
> I realized that this is not a "normal" grouping
> problem.
> 
> Can someone tell me a way to solve it -- if it
> exists....
> 
> Thanks
> Emilio
> 
> 
>  XSL-List info and archive: 
> http://www.mulberrytech.com/xsl/xsl-list
> 


__________________________________
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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-2013 All Rights Reserved.