[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] Recognize nested element (check for same-name parent)
Subject: RE: [xsl] Recognize nested element (check for same-name parent) From: "Cas Tuyn" <Cas.Tuyn@xxxxxxxx> Date: Wed, 9 Feb 2005 17:27:48 +0100 |
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.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Recognize nested element , Mukul Gandhi | Thread | Re: [xsl] Recognize nested element , David Carlisle |
Re: [xsl] Generating table rows htm, Wendell Piez | Date | Re: [xsl] Recognize nested element , David Carlisle |
Month |
Keywords