XML and HTML intermixed in the output of an XSLT transformation
I'm working on a project involving a Web API ( a RESTful one).
The response is an XML document that embed urls in the attributes of some elements. For documentation purpose I would like the url to be clickable when a human is browsing through the API so he can follow the urls and navigate the API.
My first thought was to create a client-side XSLT stylesheet to "linkify" the urls.
So far I've got a stylesheet that displays clickable links found in the xml, but out of their context. the XML is not present in the document. I'm no expert in XSLT, but to me it seems difficult to transform the xml elements (and children) from the source xml to be part of the result html.
I wonder if it's the right approach.
I've solved my problem. I've actually had the wrong approach to XSLT(I tried to think "Procedural" which is not always the best reflex for XSLT :-) ). By using various xsl:template for the elements and the non-href attribute and the href attribute, things got a lot easier. I still have to list all node my API could use, but it's not a huge vocabulary.
Now I have to make the indentation better, but that's not too complicated