Re: [xsl] multi-paragraph blockquotes

Subject: Re: [xsl] multi-paragraph blockquotes
From: JBryant@xxxxxxxxx
Date: Fri, 6 May 2005 10:24:06 -0500
Hi, Bruce,

How about the following?

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

  <xsl:template match="/">
    <html>
      <head>
        <title>Multi-paragraph Blockquote Test</title>
      </head>
      <body>
        <xsl:apply-templates/>
      </body>
    </html>
  </xsl:template>

  <xsl:template match="para">
    <p><xsl:apply-templates/></p>
  </xsl:template>

  <xsl:template match="blockquote">
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="blockquote/para">
    <p style="text-indent:.25in"><xsl:apply-templates/></p>
  </xsl:template>

</xsl:stylesheet>

That gave me (edited for spacing):

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Multi-paragraph Blockquote Test</title>
  </head>
  <body>
    <p>Some text:
      <p style="text-indent:.25in">One paragraph.</p>
      <p style="text-indent:.25in">Another paragraph.</p>
    </p>
  </body>
</html>

The result appeared properly indented in IE 6, Firefox 1.0.1, and Opera 
7.54. To get proper XHTML, you'll need to adjust the stylesheet, but the 
concept seems to work (if I understand what you want).

Tested with Saxon 8.4.

Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)




Bruce D'Arcus <bdarcus@xxxxxxxxx> 
05/06/2005 10:04 AM
Please respond to
xsl-list@xxxxxxxxxxxxxxxxxxxxxx


To
XSL-List@xxxxxxxxxxxxxxxxxxxxxx
cc

Subject
[xsl] multi-paragraph blockquotes






What's the best way to use XSLT (2.0) to convert this:

<para>Some text:
   <blockquote>
     <para>One paragraph.</para>
     <para>Another paragraph.</para>
   </blockquote>
</para>

... to what XHTML structures such that applications (browsers, but also 
MS Word) will display it right?

I've been using the hack of display-output-escaping, but am not fond of 
that approach.

So, I'm asking an XSLT question, but also an XHTML one as well.

Bruce

Current Thread