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

Create an end element - possible?

Subject: Create an end element - possible?
From: [x] cross solution <info@xxxxxxxxxxxxxxxxxx>
Date: Sun, 3 Oct 2010 14:18:46 +0200
 Create an end element - possible?
Hello List,

i want to create an "closing" element with a condition.
Base is only XSLT 1.0 - Xalan
There is a dynamic part <w:t> in the xslt process and i want to close the
</w:p> with a condition.
The condition is in a 5 level deep recursion, so i try to simplify the example
here.

<w:p>
	<w:t>This is my content</w:t>
</w:p>

it can be also (only for example - the example is reduced to the min)
<w:p>
	<w:t>This is my content</w:t>
	<w:t>This is the new content</w:t>
	<w:t>This is the other content</w:t>
</w:p>

I can't say at the beginning of <w:p> how many <w:t> will follow and so i have
an exit in the <w:t>.value, which gives me the Base of the Condition.

The template idea was:
    <xsl:template name="xParagraph">
        <xsl:param name="xValue"/>
        <xsl:choose>
            <xsl:when test="contains($xValue, 'Start')">
                <xsl:element name="p"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
            </xsl:when>
            <xsl:when
                test="not(contains($xValue, 'Cont')) and not(contains($xValue,
'End'))  ">
                <xsl:element name="p"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
            </xsl:when>
            <xsl:when test="contains($xValue, 'End')">
                </xsl:element name="p"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
            </xsl:when>
            <xsl:when
                test="not(contains($xValue, 'Cont')) and not(contains($xValue,
'Start'))  ">
                </xsl:element name="p"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
            </xsl:when>
        </xsl:choose>
    </xsl:template>

But the part of the closing element
                </xsl:element name="p"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
doesn't work.
Oxygen gives me the Error back "F [Xalan] The element type "xsl:when" must be
terminated by the matching end-tag "</xsl:when>"."

Another idea was:
    <xsl:template name="xParagraph">
        <xsl:param name="xValue"/>
        <xsl:choose>
            <xsl:when test="contains($xValue, 'Start')">
                <w:p>
            </xsl:when>
            <xsl:when
                test="not(contains($xValue, 'Cont')) and not(contains($xValue,
'End'))  ">
                <w:p>
            </xsl:when>
            <xsl:when test="contains($xValue, 'End')">
                </w:p>
            </xsl:when>
            <xsl:when test="not(contains($xValue, 'Cont')) and
not(contains($xValue, 'Start'))  ">
                </w:p>
            </xsl:when>
        </xsl:choose>
    </xsl:template>

But Oxygen gives me the Error "F [Xalan] The element type "w:p" must be
terminated by the matching end-tag "</w:p>".
Is there a way to create the closing Tag "</w:p> with a when/if condition?
Any ideas to handle this?
Output is a WordML file.

best regards

armin



Armin Egginger
[x] cross solution
Kurfuerstenstr. 28
82110 Germering
Germany
Phone:  +49 - (0)89 - 84 10 25 70
Fax: +49 - (0)89 - 84 10 25 73
USt.ID.: DE176843593

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.