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

RE: Recognize nested element (check for same-name pare

Subject: RE: Recognize nested element (check for same-name parent)
From: "Cas Tuyn" <Cas.Tuyn@xxxxxxxx>
Date: Wed, 9 Feb 2005 17:27:48 +0100
check the same
David,

   <xsl:if test="parent::step">

Worked like a charm. Thanks.

> No!  You can never access or insetr or in any way manipulate
> tags in XSLT. You can't add a start tag in one place and an
> end tag somewhere else. XSLT works on node trees and you
> can't have half a node.

I know, I've been cheating with:
<xsl:text disable-output-escaping="yes">&lt;ol&gt;</xsl:text>

My XSLT so far is:

<xsl:template match="step">
	<xsl:if test="parent::step">
		<xsl:if test="position()=1">
			<xsl:text
disable-output-escaping="yes">&lt;ol&gt;</xsl:text>
		</xsl:if>
		<li>
			<xsl:apply-templates/></li>
		<xsl:if test="position()=last()">
			<xsl:text
disable-output-escaping="yes">&lt;/ol&gt;</xsl:text>
		</xsl:if>
	</xsl:if>
	<li>
		<xsl:apply-templates/></li>
	</xsl:template>

My end result is a procedural document, with numbered steps from 1 to
say 100, and section headings inbetween like PREPARE, REMOVE PART, FIT
PART, ADJUST PART, FINALIZE, and these do not restart the numbering. So
I have already started an <ol> as soon as I see the first section, and
so the first level <step> only needs a <li> tag around it, while the
second/third needs a <ol> before the first and after the last.
I'm trying to accomplish:

XML:

<section>
  <title>PREPARE</title>
  <step>Step 1.</step>
  <step>Do as follows:
    <step>Select: Start</step>
    <step>Select: Yes</step>
  </step>
</section>
<section>
  <title>REMOVE PART</title>
  <step>Step 3.</step>
  <step>Do as follows:
    <step>Select: Initialize Motor</step>
    <step>Select: Yes</step>
  </step>
</section>

Desired output HTML:

PREPARE
 1. Step 1.
 2. Do as follows:
     2.1. Select: Start
     2.2. Select: Yes
REMOVE PART
 3. Step 3.
 4. Do as follows:
     4.1 Select: Initialize Motor
     4.2 Select: Yes


Regards,

Cas







--
The information contained in this communication and any attachments is
confidential and may be privileged, and is for the sole use of the intended
recipient(s). Any unauthorized review, use, disclosure or distribution is
prohibited. If you are not the intended recipient, please notify the sender
immediately by replying to this message and destroy all copies of this message
and any attachments. ASML is neither liable for the proper and complete
transmission of the information contained in this communication, nor for any
delay in its receipt.

Current Thread

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