karthikin Posted July 15, 2011 Share Posted July 15, 2011 Hi guys, I have a xml file and I append a new contact in my XML file from XUL.When i append a new contact I want to generate a ID to my new customer contact in my xml file using XSLT.Is it possible to load my XSLT file through my xml file and save it? Please give me a suggestion guys!!! Thank you.My xml file: <?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="idgenerator.xsl"?><CONTACTS><CONTACT><Customer-ID>N65539</Customer-ID><FirstName>Ben</FirstName><LastName>Foden</LastName><email></email><address></address><state>AZ</state><country>US</country></CONTACT><CONTACT><Customer-ID>N65539</Customer-ID><FirstName>Nimal</FirstName><LastName>Anup</LastName><email>nimal.anup@gmail.com</email><address></address><state>TN</state><country>IN</country></CONTACT><CONTACTS> My XSLT file: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes"/> <xsl:strip-space elements="*"/> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> <xsl:template match="CONTACT"> <xsl:copy> <PDE-Identity> <xsl:value-of select="generate-id(.)"/> </PDE-Identity> </xsl:copy> </xsl:template></xsl:stylesheet> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.