xsl-list
[Top] [All Lists]

RE: [xsl] How Handle Html Heading Tag using XSL

2006-06-27 06:21:15
Search for "positional grouping". It's a textbook problem. The answer is
easy in XSLT 2.0, using <xsl:for-each-group group-starting-with="h2"/>. It's
not at all easy in XSLT 1.0 - most solutions involve recursion over the
sequence of siblings.

Michael Kay
http://www.saxonica.com/

 

-----Original Message-----
From: Byomkesh [mailto:bkesh(_at_)eztechgroup(_dot_)net] 
Sent: 27 June 2006 13:38
To: Mukul Gandhi
Cc: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] How Handle Html Heading Tag using XSL

Thank you Mukul for the help!

I have one problem. How handle the html h1, h2, h3 etc., 
coding. I would like to close </h1> tag before start in 
another <h1> tag.

Example...

Input file
---------

<h1>Heading 1</h1>
<p>Some text here</p>
<h2>Heading 2</h2>
<p>Some text here</p>
<h3>Heading 3</h3>
<p>Some text here</p>
<h1>Heading 1</h1>
<p>Some text here</p>

I want.....
--------

<section1>
<title>Heading 1</title>
<p>Some text here</p>
<section2><title>Heading 2</title>
<p>Some text here</p>
<section3><title>Heading 3</title>
<p>Some text here</p>
</section3></section2></section1>
<section1><title>Heading 1</title>
<p>Some text here</p>
.....
.....
.....

Thanks

Byomkesh




----- Original Message -----
From: "Mukul Gandhi" <gandhi(_dot_)mukul(_at_)gmail(_dot_)com>
To: "Byomkesh" <bkesh(_at_)eztechgroup(_dot_)net>
Cc: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Tuesday, June 27, 2006 5:15 PM
Subject: Re: [xsl] How count the Table cell (Cals Table) using XSL


Hi Byomkesh,
  There are some problems in your code. Following corrections are
required:

<xsl:variable name="rtf">
    <xsl:call-template name="FindMaxStringLength">
        <xsl:with-param name="n" select="count(//tr[3]/td)" />
    </xsl:call-template>
</xsl:variable>
(in <xsl:template match="table"> )

and, (please note //. You wrote /)

<xsl:for-each select="//tr[2]/th[$n] | //tr/td[$n]">
   <xsl:sort select="string-length(.)" order="descending" />
   <xsl:if test="position() = 1">
     <xsl:value-of select="string-length(.)" />
   </xsl:if >
</xsl:for-each>

With these changes, I get following in the output:

<colgroup>
   <col width="21.74%"/>
   <col width="36.96%"/>
   <col width="41.3%"/>
</colgroup>

Regards,
Mukul


--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>
--~--