Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 22nd, 2008, 11:01 PM
Authorized User
 
Join Date: Apr 2008
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I could not get the way out in xslt1.0. I need this in xslt 1.0.

 
Old April 23rd, 2008, 02:11 AM
Authorized User
 
Join Date: Apr 2008
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Since it seems this 'HTML' document is, in fact, a well-formed XML document, something like that could do the trick if there is no element between the li elements :
Code:
<xsl:template match="li">
 <xsl:choose>
  <xsl:when test="name(ancestor::*[1])!='ul'">
   <xsl:if test="not(preceding-sibling::li)">
    [list]
      <xsl:for-each select=". | following-sibling::li">
       <li><xsl:apply-templates/></li>
    </xsl:for-each>
    </ul>
   </xsl:if>
  </xsl:when>
  <xsl:otherwise>
   <li><xsl:apply-templates/></li>
  </xsl:otherwise>
 </xsl:choose>
</xsl:template>
 
Old May 8th, 2008, 05:38 AM
Authorized User
 
Join Date: Apr 2008
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

When used the above code
Original List
 . first line
 . second line
 . third line

Becomes
Original List
 .first List
    . Second List
       . third list

Nesting level should remain same








Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML 4.0 vs. XHTML 1.0 and font sizes Ron Howerton HTML Code Clinic 4 October 14th, 2008 07:05 AM
xHTML to XSL:FO to PDF NotesSensei XSLT 0 September 2nd, 2006 10:02 AM
w3 HTML (XHTML) validation crmpicco HTML Code Clinic 6 June 7th, 2006 07:33 AM
xhtml-tags i xml value-of select patric_jansson XSLT 5 October 3rd, 2005 12:15 PM
How can XSL transform XHTML data into fragments? lamwh XSLT 0 April 19th, 2004 10:15 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.