Hi,
As part of transforming one form of xml to another form, i need to do the below mentioned transformation:
My Input XML:
<rss>
<channel>
<item>
<assignee username="srinivas.rachakonda">Srinivas Rachakonda</assignee>
<reporter username="aaron.burgemeister">Aaron Burgemeister</reporter>
</item>
</channel>
</rss>
My Output should be:
<bugzilla>
<bug>
<assigned_to name="Srinivas Rachakonda">srachakonda@novell.com</assinged_to>
<reporter name="Aaron Burgemeister">aaron@novell.com</reporter>
</bug>
</bugzilla>
So, i have written an XSLT as given below:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<bugzilla>
<xsl:for-each select="/rss/channel/item">
<bug>
<reporter>
<xsl:apply-templates select="reporter" />
</reporter>
<assigned_to>
<xsl:apply-templates select="assignee"/>
</assigned_to>
</bug>
</xsl:for-each>
</bugzilla>
<xsl:template match="reporter">
<xsl:attribute name="name">
<xsl:value-of select="."/>
</xsl:attribute>
<xsl:when test=". = 'Aaron Burgemeister'">aaron@novell.com</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="assignee">
<xsl:attribute name="name">
<xsl:value-of select="."/>
</xsl:attribute>
<xsl:when test=". = 'Aaron Burgemeister'">aaron@novell.com</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:template>
</xsl:stylesheet>
The above XSLT is working fine.
1) But instead of hardcoding the mail address in XSLT, can i get them from an external file?
2) There are almost 25 to 30 users which i need to map. So, it may be good if we have an external file with the list of user names & their mail addresses. From the XSLT, i need to get each user name & compare it with the current node value. Wherever the match is occured, mail address of that user i need to get from that external file.
My question is, can an XSLT read from an external file like excel sheet or any other file?
Any help in this regard would be appreciated.
Thanks,
Saritha