I have a pair of custom self closing tags s1 and s2 defined in namespace x in my xhtml. For each tag pair s1, s2 having the same id, I want to add span tags to all the text nodes between them. Each s1, s2 tag pair have a unique id. i am looking for a XSL based solution for the same. I am using Saxon java processor for XSL.
Sample input:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>This is my title</title>
</head>
<body>
<h1 align="center">
This is my heading
</h1>
<p>
Sample content Some text here. Some content here.
</p>
<p>
Here you go.
</p>
</body>
</html>
Sample Output:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>This is my title</title>
</head>
<body>
<h1 align="center">
This <span class="spanClass" id="1">is my</span>heading
</h1>
<p>
Sample content <span class="spanClass" id="2">Some text here. Some content here.</span>
</p>
<p>
<span class="spanClass" id="3">Here you</span>go.
</p>
</body>
</html>