[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Para element ??
- From: Jim Garrett <jgarrett@navix.net>
- To: xsl-list@lists.mulberrytech.com
- Date: Mon, 28 May 2001 08:19:51 -0500
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@lists.mulberrytech.com
|[mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Jeni Tennison
|Sent: Saturday, May 26, 2001 3:13 AM
|To: Mohammed Rahman
|Cc: XSL-List@lists.mulberrytech.com
|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>
</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
|