Hi I am new to xslt and i was trying to generate a generic xml from the plmxml.
Following is the plmxml.xml file
<?xml version="1.0" encoding="utf-8"?>
<PLMXML xmlns="http://www.plmxml.org/Schemas/PLMXMLSchema" schemaVersion="6" date="2008-12-02" time="15:33:22" author="Teamcenter V2007.1.3.20080417.00 - PLM@TCLICSRV(498908465)">
<Product id="id2" name="Test" accessRefs="#id3" subType="Item" productId="000019"></Product>
</PLMXML>
-------------------------------------------------------
And in the output i want <GXML> instead of <PLMXML>
and <Item> instead of <Product>
i.e my output xml should look like
<GXML>
<Item>
</Item>
</GXML>
-------------------------------------------------------
and following is my xslt but all i get is an empty file
<?xml version='1.0'?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:plm="http://www.plmxml.org/Schemas/PLMXMLSchema"
xmlns="http://www.plmxml.org/Schemas/PLMXMLSchema" exclude-result-prefixes="plm">
<xsl:strip-space elements="*" />
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<xsl:template match="/">
<xsl:variable name="elementName" select="name()"/>
<xsl:choose>
<xsl:when test="$elementName = 'PLMXML'">
<xsl:call-template name="PLMXML"></xsl:call-template>
</xsl:when>
<xsl:when test="$elementName = 'Product'">
<xsl:call-template name ="Item"></xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="PLMXML">
<xsl:element name="GXML"></xsl:element>
</xsl:template>
<xsl:template name="Item">
<xsl:element name="Item"></xsl:element>
</xsl:template>
</xsl:stylesheet>
and I am using msxsl Processor.
Can somone please help me understand where am i going wrong? All i could understand is there is some issues with namespace. I will be obliged is someone can shed more light on that or can correct my xslt.
Thanx in advance