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

Re: Transforming XML Blockquotes - Mixed Content - XSL

Subject: Re: Transforming XML Blockquotes - Mixed Content - XSLT 1.0 Solution
From: "Edward Bryant" <bryant_edward@xxxxxxxxxxx>
Date: Wed, 27 Apr 2005 14:56:15 -0500
xsl nested divs
Hello again,

Reply to David Carlisle and Wendell:

To the comments that I might try to use divs instead of the standard XHTML blockquote tag (because XHTML allows nested divs), I tried it and it doesn't work. If I remember correctly nested divs technically work but in IE6 a paragraph's initial indent is re-applied to the text following a blockquote (so, the continued part of the paragraph falsely appears to be a new paragraph). Hence, while some style features, such as line-height inherit correctly to the post blockquote text, it also incorrectly inherits the paragraph's initial indent.

Reply to David Carlisle and Michael Kay:

Thanks for David's explanation of why not to use DOE, as well as the tree-based reasoning behind XSLT (I understand why this kind of thing is a problem better). On the responses to my comment that Jay's solution was "overly complex", I did not mean that the offered solution was complex in that there were too many lines of code. What I meant was that the solution ends up handling or touching on a lot of data that isn't even involved in the blockquote problem. It is complex in that it results in a lot of extra processing of data, as in the example of a 20 page document with only one blockquote in one paragraph or the processing of documents without any blockquotes, etc.

Reply to Jay Bryant:

Thanks for your patience and your posting of a 1.0 compliant version of your solution. I did, however, have a few questions:

1. I tried to decipher this XPATH expression but I can't seem to understand it, can someone help explain what this is doing

p[not(preceding-sibling::*[1]/self::p)]

2. In the below stylesheet (the second of the two you offered), how do you differentiate between the p representing the initial paragraph and the continued paragraph p tags. I need to figure out a way to output the original paragraph's "num" attribute next to the start of each real paragraph (but not repeat it for the new p tags surrounding the continued paragraph text).

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">


 <xsl:template match="x">
 <html>
 <head>
 <title>Paragraph Chunking Test</title>
 <link rel="stylesheet" type="text/css" href="style.css" />
 </head>
 <body>
   <xsl:for-each select="p[not(preceding-sibling::*[1]/self::p)]">
   <xsl:variable name="group" select="@group"/>
   <p>
     <xsl:for-each select="../p[@group=$group]">
       <xsl:apply-templates/>
     </xsl:for-each>
   </p>
   <xsl:apply-templates select="following-sibling::blockquote"/>
   </xsl:for-each>
 </body>
 </html>
 </xsl:template>

<xsl:template match="p"/>

 <xsl:template match="blockquote">
   <xsl:copy-of select="."/>
 </xsl:template>

 <xsl:template match="span">
   <xsl:copy-of select="."/>
 </xsl:template>

</xsl:stylesheet>

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.