xsl-list
[Top] [All Lists]

Re: Re: xsl-list Digest 13 Apr 2005 05:10:00 -0000 Issue 386

2005-04-13 10:21:41
Daniel O.,
For XSLT 1.0 I have the following solutions to suggest:

There is a simple hack you could try.

<xsl:template match="p[child::blockquote]">
  <xsl:element name="p">
    <xsl:apply-templates select="@* | * | text()"/>
  </xsl:element>
</xsl:template>

<xsl:template match="blockquote[parent::p]">
  <xsl:text disable-output-escaping="yes">&lt;/p&gt;</xsl:text>
  <xsl:element name="{local-name()}">
    <xsl:apply-templates select="@* | * | text()"/>
  </xsl:element>
  <xsl:text disable-output-escaping="yes">&lt;p&gt;</xsl:text>
</xsl:template>

If this was unacceptable, I would use the saxon:node-set() function.
1. collect the entire document into a node-set variable.
2. create an attribute for each <p> giving the position number from
the root.
3. create a template for the node-set ($my_doc)//p/child::blockquote.
4. create a node-set of each p/child:blockquote numbering the nodes.
5. send the $x (beginning node) and $y (end node) to a call-template.
6. process these nodes before and after the blockquote inside a new
<p>.
7. process the blockquote normally.

This is a lot of work, but it is legal.

Mike Ferrando
Library Technician
Library of Congress
Washington, DC
202-707-4454

--- Daniel O'Donnell <daniel(_dot_)odonnell(_at_)uleth(_dot_)ca> wrote:
Transforming XML Blockquotes - Mixed Content 14744 by: Edward
Bryant 
14745 by: James Fuller 14746 by: Edward Bryant

I am having a lot of trouble transforming XML blockquotes that
are
structurally and grammatically correct (i.e, as child elements to
a
parent paragraph tag) into XHTML that will be displayed correctly
by
a browser. Because of two separate IE6 bugs that prevent a
blockquote
from being structured as the child of a paragraph, I pretty much
need
the XSL output to be

<p>Yadda yadda yadda:</p> <blockquote><p>blah blah
blah</p></blockquote> <p class="cont">yackity yack</p>


However, the XML is structured like this:

<p>Yadda yadda yadda: <blockquote>blah blah blah</blockquote>
yackity
yack</p>


So, my first thought was to make a conditional statement that
would
do this but I am having a lot of trouble constructing it. I can
not
locate any information on a conditional statement that would test
whether one element (p) with mixed conternt contained another
element
(blockquote). I also am having trouble with a way to split up the
p
tag's text into the pre-blockquote and post-blockquote strings.
Even
with the above problems, I haven't even touched on the problems
that
a paragraph with multiple blockquotes would cause.

As Jim noted, I was asking the same question earlier in the day
(how 
weird is that). I've still not managed to get a XSLT 1.0 solution
(which 
I need), but in XSLT 2.0 it is really easy. There is even an
example in 
the recommendation that mutatis mutandis works out of the box: 
<http://www.w3.org/TR/xslt20/#d5e20377> "Grouping Alternating
Sequences 
of Elements".

-dan

-- 
Daniel Paul O'Donnell, PhD
Associate Professor of English
University of Lethbridge
Lethbridge AB T1K 3M4
Tel. (403) 329-2377
Fax. (403) 382-7191
E-mail <daniel(_dot_)odonnell(_at_)uleth(_dot_)ca>
Home Page <http://people.uleth.ca/~daniel.odonnell/>
The Digital Medievalist Project:
<http://www.digitalmedievalist.org/>



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




                
__________________________________ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/

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



<Prev in Thread] Current Thread [Next in Thread>