RE: Recognize nested element (check for same-name pare
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"><ol></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"><ol></xsl:text> </xsl:if> <li> <xsl:apply-templates/></li> <xsl:if test="position()=last()"> <xsl:text disable-output-escaping="yes"></ol></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.
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