xml - Simple XSL transform -


OK, Friday afternoon and I need to complete it:

The following should be XML Converted:

  & lt ;? XML version = "1.0" encoding = "UTF-8"? & Gt; & Lt; ProfiledSettings & gt; & Lt; Property Set file = "properties.txt" & gt; & Lt; Property Name = "Scheduler Time" & gt; 19h30 & lt; / Property & gt; & Lt; / PropertySet> & Lt; Property Set file = "Properties 2.txt" & gt; & Lt; Property Name = "inclusions.filters" /> & Lt; Property Name = "Inclusion" /> & Lt; / PropertySet> & Lt; / ProfiledSettings & gt;  

To do this:

  & lt ;? XML version = "1.0" encoding = "UTF-8"? & Gt; & Lt; ProfiledSettings & gt; & Lt; Property Set file = "properties.txt" & gt; & Lt; Property Name = "Scheduler Time" & gt; 19 & lt; / Property & gt; & Lt; / PropertySet> & Lt; Property Set file = "Properties 2.txt" & gt; & Lt; Property Name = "inclusions.filters" /> & Lt; Property Name = "Inclusion" /> & Lt; / PropertySet> & Lt; / ProfiledSettings & gt;  

Note that '19-30' was changed to '19'.

My xslt is not good, but I know that it should be simple.

How should this change look like the XSLT document?

Match the property that you want to change, copies the second template input property node, With all its features, and modifying text content.

  & lt ;? XML version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Xsl: stylesheet xmlns: xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" & gt; & Lt; Xsl: template match = "@ * | node ()" & gt; & Lt; XSL: Copy & gt; & Lt; Xsl: apply-select template = "@ * | node ()" /> & Lt; / XSL: Copy & gt; & Lt; / XSL: Templates & gt; & Lt; Xsl: Template Match = "Property [@name = 'Scheduler Time']" & gt; & Lt; XSL: Copy & gt; & Lt; Xsl: Apply-Choose Template = "@ *" /> & Lt; Xsl: select value = "substring-before (text (), 'h')" /> & Lt; / XSL: Copy & gt; & Lt; / XSL: Templates & gt; & Lt; / XSL: stylesheet & gt;  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -