How to populate the span tags between specific tags.
- by Rachel
I want to populate span tags for all text nodes between the self closing tags s1 and s2 having the same id.If the transformation of the input to the output form requires the list of ids of the s1 , s2 tag pairs say 1, 2 etc i can assume that it is in place in any form if required.The input can have any structure and not exactly the same as seen in the sample input. It can have any number of s1, s2 tag pairs but each pair will have a unique id.
Hope i am clear. How can this be achieved using XSL?
Input:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>This is my title</title>
</head>
<body>
<h1 align="center">This <s1 id="1" />is my <s2 id="1" />heading</h1>
<p>
Sample content <s1 id="2" />Some text here. Some content here.
</p>
<p>
Here you <s2 id="2" />go.
</p>
</body>
</html>
Desired output:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>This is my title</title>
</head>
<body>
<h1 align="center">This <span id="1">is my </span>heading</h1>
<p>
Sample content <span id="2">Some text here. Some content here.</span>
</p>
<p>
<span id="2">Here you </span>go.
</p>
</body>
</html>