This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: BOUNCE xsl-list@lists.mulberrytech.com: Admin request of type /\bremove\b/i at line 1
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] BOUNCE xsl-list@lists.mulberrytech.com: Admin request of type /\bremove\b/i at line 1
- From: Wendell Piez <wapiez at mulberrytech dot com>
- Date: Thu, 11 Jan 2001 15:12:39 +0000
- Reply-To: xsl-list at lists dot mulberrytech dot com
Kurt,
The "Gordian knot" solution is to simply select the elements you know you
want, and have the stylesheet provide the intervening text:
<xsl:template match="book" mode="reference">
<xsl:apply-templates select="title"/>
<xsl:text>, </xsl:text>
<xsl:apply-templates select="author"/>
</xsl:template>
This approach assumes that you want the punctuation to be consistent, so it
is fair to control it in the stylesheet rather than pick it up from the
source. (This doesn't seem like an unfair assumption in your case.)
Implicitly it makes the argument that "hey, those commas are really markup
(delimiting meaningful snippets of data), not really data at all, so the
stylesheet doesn't have to respect them." Of course, if this is not the
case (if the punctuation is actually significant as data), you have to do
something like the solution Jeni provided.
It's interesting that punctuation, in print, often inhabits that grey zone
between data and markup....
Regards,
Wendell
>Simple Example
>---
>DTD
><!ELEMENT book (#PCDATA | title | author | date)* >
><!ELEMENT title|author|date (#PCDATA) >
>
>
>XML
><book><title>My Book</title>, <author>Me</author>,
><date>01-01-01</date></book>
>
>
>HTML (main section)
><u>My Book</u>, Me, (01-01-01)
>
>
>HTML (reference section)
><u>My Book</u>, Me
At 09:28 AM 1/11/01 -0500, Jeni wrote:
> From Kurt.Devlin@westgroup.com Wed Jan 10 11:52:57 2001
>Received: from electabuzz.westgroup.com (electabuzz.westgroup.com
>[163.231.238.98])
> by biglist.com (8.8.8/8.8.5/BL-2) with ESMTP id LAA24426
> for <xsl-list@lists.mulberrytech.com>; Wed, 10 Jan 2001 11:52:57
> -0500 (EST)
>Received: from electabuzz.westgroup.com (localhost.localdomain [127.0.0.1])
> by electabuzz.westgroup.com (8.9.3/8.9.3) with ESMTP id KAA03661
> for <xsl-list@lists.mulberrytech.com>; Wed, 10 Jan 2001 10:52:26
> -0600
>Received: from elk.int.westgroup.com (elk.int.westgroup.com [163.231.101.86])
> by electabuzz.westgroup.com (8.9.3/8.9.3) with ESMTP id KAA03651
> for <xsl-list@lists.mulberrytech.com>; Wed, 10 Jan 2001 10:52:26
> -0600
>Received: by elk.int.westgroup.com with Internet Mail Service (5.5.2653.19)
> id <CTKFDHYY>; Wed, 10 Jan 2001 10:52:26 -0600
>Message-ID:
><B15A0DE524B8D111A26900805F0D6FFE058C1AF8@conesus.roc.westgroup.com>
>From: "Devlin, Kurt" <Kurt.Devlin@westgroup.com>
>To: "Xsl-List (E-mail)" <xsl-list@lists.mulberrytech.com>
>Subject: Remove PCDATA prior to a specified element
>Date: Wed, 10 Jan 2001 10:52:24 -0600
>MIME-Version: 1.0
>X-Mailer: Internet Mail Service (5.5.2653.19)
>Content-Type: text/plain;
> charset="iso-8859-1"
>
>I need to remove some PCDATA prior to a specified element. I am rendering my
>XML to HTML. In the main section I want all the information shown. In the
>table of references that gets generated at the end of the document, I want
>to strip certain elements and the PCDATA that appears directly before that
>element.
>
>Currently, I have templates that ignore the elements that I'm not
>interested, but I'm not sure how to get to the PCDATA before this element.
>
>I have created a simple example of what I want to do below. In this example
>it would be simple to just look at the elements that I do want, but in my
>real project there are too many elements that I do want. I really only want
>to add a couple of templates to handle ignoring the element and its
>preceding PCDATA.
>
>Thanks in advance for any help with this.
>
>Regards,
>Kurt
>---
>Simple Example
>---
>DTD
><!ELEMENT book (#PCDATA | title | author | date)* >
><!ELEMENT title|author|date (#PCDATA) >
>
>XML
><book><title>My Book</title>, <author>Me</author>,
><date>01-01-01</date></book>
>
>HTML (main section)
><u>My Book</u>, Me, (01-01-01)
>
>HTML (reference section)
><u>My Book</u>, Me
>---
>
>XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
======================================================================
Wendell Piez mailto:wapiez@mulberrytech.com
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list