xslt - XML elements need to be renamed using xsl file -



xslt - XML elements need to be renamed using xsl file -

xml elements "row" need renamed "case" , "ckey" need renamed "key"

source file: in case containing row , ckey xml elements need replaced above mentioned

<dst> <pqcallhistory> <hostaddress>$$$$$$$</hostaddress> <hostport>$$$$$</hostport> <userid>$$$$$</userid> <password>$$$$$</password> <folder> <crdattim>2012112302.44.40.334480</crdattim> <recordcd>f</recordcd> <crnode>01</crnode> <casecount>10</casecount> <lastcrdattim>2014040202.23.10.105840</lastcrdattim> <row> <crdattim>2014061709.58.36.947900</crdattim> <cmedia>phone</cmedia> <crnode>01</crnode> <recordcd>c</recordcd> <unitcd>csmhcqa</unitcd> <statcd>created</statcd> <stptim>2014061720.28.35.000000</stptim> <cmood>happy</cmood> <ckey>2014061709.58.36.947900c01</ckey> </row> <row> <crdattim>2014061709.52.53.157900</crdattim> <cmedia>phone</cmedia> <crnode>01</crnode> <recordcd>c</recordcd> <unitcd>csmhcqa</unitcd> <statcd>created</statcd> <stptim>2014061720.22.51.000000</stptim> <cmood>happy</cmood> <ckey>2014061709.52.53.157900c01</ckey> </row> <row> <crdattim>2014061605.05.44.690900</crdattim> <cmedia>phone</cmedia> <crnode>01</crnode> <recordcd>c</recordcd> <unitcd>csmhcqa</unitcd> <statcd>created</statcd> <stptim>2014061615.35.42.000000</stptim> <cmood>happy</cmood> <ckey>2014061605.05.44.690900c01</ckey> </row> <row> <crdattim>2014061604.58.39.446900</crdattim> <cmedia>phone</cmedia> <crnode>01</crnode> <recordcd>c</recordcd> <unitcd>csmhcqa</unitcd> <statcd>created</statcd> <stptim>2014061615.28.35.000000</stptim> <cmood>happy</cmood> <ckey>2014061604.58.39.446900c01</ckey> </row> <row> <crdattim>2014061104.03.59.807840</crdattim> <cmedia>phone</cmedia> <crnode>01</crnode> <recordcd>c</recordcd> <unitcd>csmhcqa</unitcd> <statcd>created</statcd> <stptim>2014061114.33.53.000000</stptim> <cmood>happy</cmood> <ckey>2014061104.03.59.807840c01</ckey> </row> </folder> </pqcallhistory> </dst> expected file : file, expected. <pqcallhistory> <hostaddress>$$$$$$$$</hostaddress> <hostport>$$$$$</hostport> <userid>$$$$$$$</userid> <password>$$$$$</password> <folder> <crdattim>2012112302.44.40.334480</crdattim> <recordcd>f</recordcd> <crnode>01</crnode> <casecount>10</casecount> <lastcrdattim>2014040202.23.10.105840</lastcrdattim> <case> <crdattim>2014052900.56.23.813840</crdattim> <cmedia>phone</cmedia> <crnode>01</crnode> <recordcd>c</recordcd> <unitcd>csmhcqa</unitcd> <statcd>created</statcd> <stptim>2014052911.26.20.000000</stptim> <cmood>happy</cmood> <key>2014052900.56.23.813840c01</key> </case> <case> <crdattim>2014052208.02.59.494840</crdattim> <cmedia>phone</cmedia> <crnode>01</crnode> <recordcd>c</recordcd> <unitcd>csmhcqa</unitcd> <statcd>created</statcd> <stptim>2014052218.32.46.000000</stptim> <cmood>happy</cmood> <key>2014052208.02.59.494840c01</key> </case> <case> <crdattim>2014042403.02.31.131840</crdattim> <cmedia>phone</cmedia> <crnode>01</crnode> <recordcd>c</recordcd> <unitcd>csmhcqa</unitcd> <statcd>created</statcd> <stptim>2014042413.32.23.000000</stptim> <cmood>happy</cmood> <key>2014042403.02.31.131840c01</key> </case> <case> <crdattim>2014040202.24.00.823840</crdattim> <cmedia>phone</cmedia> <crnode>01</crnode> <recordcd>c</recordcd> <unitcd>csmhcqa</unitcd> <statcd>created</statcd> <stptim>2014040212.53.58.000000</stptim> <cmood>happy</cmood> <key>2014040202.24.00.823840c01</key> </case> <case> <crdattim>2014040202.23.10.105840</crdattim> <cmedia>phone</cmedia> <crnode>01</crnode> <recordcd>c</recordcd> <unitcd>csmhcqa</unitcd> <statcd>created</statcd> <stptim>2014040212.53.08.000000</stptim> <cmood>happy</cmood> <key>2014040202.23.10.105840c01</key> </case> </folder> </pqcallhistory> </dst>

can 1 help me on this...

use xslt.. i've removed xsl:copy template , look contained "//pq" there no such element in input xml:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()" /> </xsl:copy> </xsl:template> <xsl:template match="pqcallhistory/folder/row"> <case> <xsl:apply-templates select="@* | node()" /> </case> </xsl:template> </xsl:stylesheet>

xml xslt

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -