Hi,
I use XML and SGML on a daily basis for my work (Technical Author) but i'm only just at the very beginning stages of getting into XSLT.
I have a bunch of SGML documents (not XML, so this may be the first problem) which are not parsing against the DTD due to some elements being out of context.
In the text of our documents, when referencing to another section, figure or table, the element
Code:
<xref id"f001" idtype"figure"></xref>
can be used (id attribute obviously varies depending on what is being linked to).
The problem is that somehow, when these documents were originally authored, somebody has inserted text within the opening and closing Xref element tags - which we don't want. So what we end up with is something like this:
Code:
<para>Refer to <xref xrefid="f001" xidtype="figure"> Undo the 10 M3 countersunk screws that attach the required Electronic Assembly to its mounting brackets.
</xref></para>
What i need to be able to do, is find an automated way of extracting the text from within the Xref element and re-insert it after the closing Xref tag, so we end up with:
Code:
<para>Refer to <xref xrefid="f001" xidtype="figure"></xref>. Undo the 10 M3 countersunk screws that attach the required Electronic Assembly to its mounting brackets.</para>
Is this possible with XSLT or am i barking up the wrong proverbial tree?
Also, and along similar lines, in places somebody has managed to insert Xref elements within the opening and closing tags of other Xref elements ... which is against the rules of the DTD.
Again, is it possible to automate the correction of this do you think? I can provide a test file if it is possible to achieve and anybody wishes to see the source.
Many thanks