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

layered lists

Subject: layered lists
From: "Szabo, Patrick (LNG-VIE)" <patrick.szabo@xxxxxxxxxxxxx>
Date: Thu, 20 Nov 2008 16:29:38 +0100
 layered lists
Hi,

I4m still using XSLT 2.0 and Saxon 9.

I have another problem with my list thing. Here is an extract of an example
xml input:

<liste>
	<ziffernliste ebene="1">
		<listelem><symbol >1.</symbol>text</listelem>
		<listelem><symbol >2.</symbol>text</listelem>
	</ziffernliste>
	<schluss>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</schluss>
	<schluss>YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY</schluss>

	<literaliste ebene="2">
		<listelem><symbol >1.</symbol>text</listelem>
		<listelem><symbol >2.</symbol>text</listelem>
	</literaliste>
	<schluss>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</schluss>
	<schluss>YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY</schluss>

	<subliteraliste ebene="3">
		<listelem><symbol >1.</symbol>text</listelem>
		<listelem><symbol >2.</symbol>text</listelem>
	</subliteraliste>
	<schluss>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</schluss>
	<schluss>YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY</schluss>

	<strichliste ebene="4">
		<listelem><symbol >1.</symbol>text</listelem>
		<listelem><symbol >2.</symbol>text</listelem>
	</strichliste>
	<schluss>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</schluss>
	<schluss>YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY</schluss>

	<ziffernliste ebene="1">
		<listelem><symbol >1.</symbol>text</listelem>
		<listelem><symbol >2.</symbol>text</listelem>
	</ziffernliste>
	<schluss>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</schluss>
	<schluss>YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY</schluss>
</liste>

The attribute "ebene" shows wich layer the list sould be in.

Desired output:

<nummerierte-liste>
            <listnum>1.</listnum>
            <punkt>
               <absatz>text</absatz>
            </punkt>
            <listnum>2.</listnum>
            <punkt>
               <absatz>text</absatz>
               <absatz>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</absatz>
		   <absatz>YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY</absatz>
            </punkt>
		<punkt>
			<liste>
                		<punkt><absatz>text</absatz></punkt>
                        <punkt>
               			<absatz>text</absatz>
               			<absatz>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</absat
z>
		  			 <absatz>YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY</absatz>
            		</punkt>
				<punkt>
					...next-list...
				</punkt>
			</liste>
		<punkt>

<nummerierte-liste>

So what i want basicly is:

ebene 1
	ebene 2
		ebene 3
			ebene 4
ebene 1

This input is not how it has to look like. It could also be like:

ebene 1
	ebene 2
		ebene 3
	ebene 2
		ebene 3
			ebene 4
		ebene 3
...

My XSLT looks like this (layers not considered):

...
 <xsl:template match="ris:liste">
        <xsl:for-each-group select="*" group-starting-with="ris:ziffernliste |
ris:strichliste | ris:literaliste | ris:subliteraliste">
            <xsl:apply-templates select="current-group()[1]"/>
        </xsl:for-each-group>
    </xsl:template>

    <xsl:template match="ris:ziffernliste">
        <nummerierte-liste>
            <xsl:apply-templates select="ris:listelem" mode="ziffer"/>
        </nummerierte-liste>
    </xsl:template>

    <xsl:template match="ris:listelem" mode="ziffer">
        <listnum>
            <xsl:apply-templates select="ris:symbol"/>
        </listnum>
        <punkt>
            <absatz><xsl:apply-templates
select="node()[not(self::ris:symbol)]"/></absatz>
            <xsl:if test="position() eq last()">
                <xsl:apply-templates
select="current-group()[self::ris:schluss]"/>
            </xsl:if>
        </punkt>
    </xsl:template>

    <xsl:template match="ris:strichliste | ris:literaliste |
ris:subliteraliste">
        <liste>
            <xsl:apply-templates select="ris:listelem" mode="otherlists"/>
        </liste>
    </xsl:template>

    <xsl:template match="ris:listelem" mode="otherlists">
        <punkt>
            <absatz><xsl:apply-templates
select="node()[not(self::ris:symbol)]"/></absatz>
            <xsl:if test="position() eq last()">
                <xsl:apply-templates
select="current-group()[self::ris:schluss]"/>
            </xsl:if>
        </punkt>
    </xsl:template>

    <xsl:template match="ris:schluss">
        <absatz>
            <xsl:apply-templates/>
        </absatz>
    </xsl:template>

    <xsl:template match="ris:symbol">
        <xsl:apply-templates/>
    </xsl:template>
...



I4m desperate -.-, can anyone help me ?!

Patrick Szabo
EPD / XSLT Konvertierung
Tel.: +43-1-534 52-1573
Fax.: +43-1-534 52-1573
patrick.szabo@xxxxxxxxxxxxx

LexisNexis Verlag ARD Orac GmbH & Co KG
Marxergasse 25, 1030 Wien
FN 8333f, Handelsgericht Wien
www.lexisnexis.at <http://www.lexisnexis.at/>

 <file://C:\Dokumente und
Einstellungen\szaboP\Anwendungsdaten\Microsoft\Signatures\LN Vienna
signature-Dateien\image001.jpg>

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.