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

Para element ??

  • From: Jim Garrett <jgarrett@n...>
  • To: xsl-list@l...
  • Date: Mon, 28 May 2001 08:19:51 -0500

para element

Hi Jeni and All..

I know I must be missing the obvious, but what
exactly is a para element...
I see it on the books and on the lists, but I have
search high and low and have not found a very
good definition of it.

Is it similar to "foo-bar" or is para an actual
wild card for something ??

I have quoted a reply from Jeni Tennison below
that talks about "para" element.
Thanks


|-----Original Message-----
|From: owner-xsl-list@l...
|[mailto:owner-xsl-list@l...]On Behalf Of Jeni Tennison
|Sent: Saturday, May 26, 2001 3:13 AM
|To: Mohammed Rahman
|Cc: XSL-List@l...
|Subject: Re: [xsl] How to perse the whole source document
|
|
|Hi Mo,
|
|The XSLT is parsing the entire source document, it's just that you're
|only accessing part of it.  You're stepping through the content of a
|section element one node at a time in order to group the para
|elements.  However, when you find a para element, you're only moving
|on to the next para element with the same name - if there isn't one
|you stop, so the section elements afterwards are ignored.
|
|Perhaps it'd be better to try a different approach - apply templates
|to everything and test within a template what you need to do.  So,
|when you find a section element, create a sid and apply templates to
|everything inside it:
|
|<xsl:template match="section">
|   <sid>
|      <xsl:apply-templates />
|   </sid>
|</xsl:template>
|
|When you find a para element, test whether its preceding sibling is a
|para element with the same name as it has - if it is, do nothing, if
|it isn't, do all the funky stuff you want to do with the para element:
|
|<xsl:template match="para">
|   <xsl:variable name="as" select="@name" />
|   <xsl:if test="preceding-sibling::para[1]/@name != $as">
|      <text name="{$as}">
|         <xsl:apply-templates select="." mode="content" />
|         <xsl:copy-of select="document('doc2.xml')
|            /TableName/RecordName[normalize-space(name) = $as]
|            /*[not(self::name)]" />
|      </text>
|   </xsl:if>
|</xsl:template>
|
|<xsl:template match="para" mode="content">
|   <xsl:copy-of select="node()" />
|   <xsl:text>&#xa;</xsl:text>
|   <xsl:apply-templates mode="content"
|      select="following-sibling::*[1][@name = current()/@name]" />
|</xsl:template>
|
|I hope that helps,
|
|Jeni
|
|---
|Jeni Tennison
|http://www.jenitennison.com/
|
|
|
| XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
|


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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.