xml - Append header and footer if they don't exist with XSLT -
How can I do XML XML input XML input inside a native node, if it does not already exist?
For example, if I have an input:
& lt; Project & gt; ... & lt; / Project & gt;
I want to wrap it with a prefix and suffix:
& lt ;? Xml version "1.0" encoding = "UTF-8" & gt; & Lt; Site & gt; & Lt; Project & gt; ... & lt; / Project & gt; & Lt; / Site & gt;
However, & lt; Project & gt; The root node of the input is not, I want the input to be un-attached.
Thank you in advance!
This stylesheet:
& lt; Xsl: stylesheet version = "1.0" xmlns: xsl = "http://www.w3.org/1999/ XSL / conversion" & gt; & Lt; Xsl: template match = "@ * | node ()" name = "detection" & gt; & Lt; XSL: Copy & gt; & Lt; Xsl: apply-select template = "@ * | node ()" /> & Lt; / XSL: Copy & gt; & Lt; / XSL: Templates & gt; & Lt; Xsl: template match = "/ project" & gt; & Lt; Site & gt; & Lt; Xsl: call-template name = "identity" /> & Lt; / Site & gt; & Lt; / XSL: Templates & gt; & Lt; / XSL: stylesheet & gt;
Input 1:
& lt; Project & gt; ... & lt; / Project & gt;
Output 1:
& lt; Site & gt; & Lt; Project & gt; ... & lt; / Project & gt; & Lt; / Site & gt;
Input 2:
& lt; Root & gt; & Lt; Project & gt; ... & lt; / Project & gt; & Lt; / Root & gt;
Output 2:
& lt; Root & gt; & Lt; Project & gt; ... & lt; / Project & gt; & Lt; / Root & gt;
Note : Identification Change Pattern Match
Comments
Post a Comment