xsl-list
[Top] [All Lists]

[xsl] selecting a section element which parent element doesn't have any element other than title element

2009-08-06 05:21:55
Hi Team,

I need the following output from the following input. In the following
Input1 example, "..." means any opening and closing tag can be present.

Input1:

<book>
<section>
<title>Section 1 title Present here</title>
...
<section>
<title>Section 2 title present here</title>
</section>
</section>
</book>

Output1:

<book>
<section role="H1">
<title>Section 1 title Present here</title>
...
<section role="H2">
<title>Section 2 title present here</title>
</section>
</section>
</book>


Input2:

<book>
<section>
<title>Section 1 title Present here</title>
<section>
<title>Section 2 title present here</title>
</section>
</section>
</book>

Output2:

<book>
<section role="H1">
<title>Section 1 title Present here</title>
<section role="H2H1">
<title>Section 2 title present here</title>
</section>
</section>
</book>            

I am using the same style sheet to achieve these two outputs. I don?t have
any issues in achieving output1. The problem is in output2. I need to select
the "section" element which parent is "section" that doesn't contain any
tags other than "title" element.

Can you please anyone suggest to me how to achieve this in XSLT 2.0?

Thanks in advance.

Thanks
Srinivasan
 


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>