RE: [xsl] listing elements & sub-elements in a seqence - skiping

Subject: RE: [xsl] listing elements & sub-elements in a seqence - skiping
From: Karl <call14@xxxxxxxxx>
Date: Wed, 26 Jul 2006 10:42:06 +0100 (BST)
Thanks Charles. However, I think you overlooked a minor thing when
mentioning [I have another q at the end. Pls have a look]

---------

If you use:
<xsl:apply-templates select="//Session/Section" />
you will get the same output as:

<xsl:for-each select="//Section[not(SubSection)] |
//Section/SubSection"/>

or 
<xsl:for-each select="//Session/Section" />
------
by writing "//Section[not(SubSection)] | //Section/SubSection, What
I am trying to achieve is
-        select section ONLY if there are NO subsection i.e ignore
those sections that have subsection &
-        If there are subsections, then loop thro each subsection
(ignoring section element)

May be my sample xml is bad. So, I give a better example here [real
xml have many other elements & contents]. Pls ignore any spell
mistake or case mistake like section or Section.

<session>
            <section>
                        <title>1</title>
            </section>
            <section>
                        <title>2</title>
            </section>
            <section>
                        <title>3</title>
                        <subsection>
                                    <title>3.1</title>
                        </subsection>
                        <subsection>
                                    <title>3.2</title>
                        </subsection>
            </section>
            <section>
                        <title>4</title>
            </section>
            <section>
                        <title>5</title>
                        <subsection>
                                    <title>5.1</title>
                        </subsection>
                        <subsection>
                                    <title>5.2</title>
                        </subsection>
            </section>
</session>

Assuming my intention is use <title>,What I intend to generate is

1.html

2.html

3.1.html [pls note section 3.html is not generated because of 
//Section[not(SubSection)] ]

3.2.html

4.html

5.1 html  [again 5.html will not be generated]

5.2.html

Having mentioned this, I wish to ask another Q  I think this I can
get only using xsl grouping / xsl:key but understand xslt 2 has
better option

If I need to display an html output like

1.title  [section title]  will actually be linked to 1.html

2.title

3.title [ie section title appears only once before the start of 1st
subsection title & no links as 3.html is not exist]

3.1 title [subsection title]  will be linked to 3.1.html

3.2 title [subsection title]

4.title

5.title [section title]

 5.1 title [subsection title]

 5.2 title [subsection title]

And so on

Thanks,
karl




	
	
		
___________________________________________________________ 
All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine 
http://uk.docs.yahoo.com/nowyoucan.html

Current Thread