[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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>
</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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|