I was instructed to learn xsl in order to update some of our xml documents at work, and I studied some tutorials for xsl, although I still have to find what I would ideally be looking for ...
Since im is not working, there is a small example of heres that he is looking for:
<?xml version="1.0" encoding="UTF-8"?>
<application>
<id>627</id>
<name>application1</name>
<url>www.application.com</url>
</application>
I would need to convert this to:
<?xml version="1.0" encoding="UTF-8"?>
<application>
<id>627</id>
<application_name>application1</application_name>
<url>www.application.com</url>
</application>
Now, from the examples and tutorials that I saw, I could do this with a hard coded xsl sheet that looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" encoding="UTF-8"/>
<xsl:template match="/">
<application>
<xsl:apply-templates/>
</application>
</xsl:template>
<xsl:template match="id">
<id>
<xsl:value-of select="id"/>
<xsl:apply-templates/>
</id>
</xsl:template>
<xsl:template match="name">
<application_name>
<xsl:value-of select="name"/>
<xsl:apply-templates/>
</application_name>
</xsl:template>
<xsl:template match="url">
<url>
<xsl:value-of select="url"/>
<xsl:apply-templates/>
</url>
</xsl:template>
</xsl:stylesheet>
But that really would not be practical, since we have about 50 different xml documents that may need to be changed, and so I really looked for the whole template that I can use, and then only redefine the corresponding element that needs to be changed.
Does this functionality exist in xsl?