In HTML there are tags for underlining and making bold, <u> and <b> respectively. Suppose I create a tag which does either of these or both, then how to interpret it using XSLT..?
For example –
<Line type="B">stackoverflow</Line>
<Line type="U">stackoverflow</Line>
<Line type="BU">stackoverflow</Line>
The HTML output should be like this –
<b>stackoverflow</b>
<u>stackoverflow</u>
<b><u>stackoverflow</b></u>
I guess this functionality will only be with XSLT part.
One way to do this is with a recursive template, which recursively checks each letter of the type attribute of the line. So, to create the first element you would do the following (where $type is the variable containing the attribute value):
Then you would recursively call the named template with the remaining part of the attribute value
So, given the following XSLT
When applied to the following XML
Will output the following
Note, to stop the Lines element being output in this case, just add the following template to the XSLT: