can I convert the following code
into
Jithendarl
1234
jithendrl@gmail.com
This is a simple solution to your problem:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:template match="employee">
<employee>
<xsl:call-template name="employeeCommentTransformer">
<xsl:with-param name="commentString" select="comment()"/>
</xsl:call-template>
</employee>
</xsl:template>
<xsl:template name="employeeCommentTransformer">
<xsl:param name="commentString"/>
<name><xsl:value-of select="substring-before(substring-after($commentString, 'name>'), 'name')"/></name>
<id><xsl:value-of select="substring-before(substring-after($commentString, 'id>'), 'id')"/></id>
<email><xsl:value-of select="substring-before(substring-after($commentString, 'email>'), 'email')"/></email>
</xsl:template>
</xsl:stylesheet>
For the scanning of the comment-string XPath
substring functions are used, depending on your
XSLT processor you may use regular-expression
matching.
Hi
I’m not aware of a reasonable way of solving this issue.
Probably it is possible (actually you may have to implement an XML parser
using XSLT) - but tedious.
What is the application scenario you want to solve?
Best regards
Uli
Actually we are extracting data from visf database and converting it to xml format.For this conversion we are using different versions of bridges.Now the task in front of us is that we have to give the backward compatability for the bridges.
There are two versions of DTDs D1 and D2. Xml file which conforms with D1 can be converted to D2.But not vise versa. Now we are planning to write a trnsfermatin where in all the elements which are not used in D2 schema file will be kept in PI or comments . And these can be extracted when we convert the xml from D2 to D1.
Please let me know if you have any good solution.
Jithu