c# - Is it possible to apply a template on xsl parameter before applying the tempates on the xml -


I have an XSL parameter that is a string. I want to parse that string, split it and make every substring I want to apply the template to XML for the value.

Is this possible? If so, can you advise an optimistic solution?

thanks

edit : Sorry, Ask questions.

The answer is yes .

Input:

  & lt; Secuence & gt; Item 1 item 2 object 3 & lt; / Secuence & gt;  

Style sheet:

  & lt; Xsl: stylesheet version = "1.0" xmlns: xsl = "http://www.w3.org/1999/ XSL / conversion" & 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 = "security / text ()" name = "security" & gt; & Lt; Xsl: Select the ultimate name = "string" = "." / & Gt; & Lt; Xsl: choose the ultimate name = "separator" = "'" ">  & Lt; With xsl: select param name = "separator" = "$ separator" /> & Lt; / XSL: Call-templates & gt; & Lt; Xsl: call-template name = "security" & gt; & Lt; With xsl: select param name = "string" = "substring-after ($ string, $ separator)" /> & Lt; With xsl: select param name = "separator" = "$ separator" /> & Lt; / XSL: Call-templates & gt; & Lt; / XSL: When & gt; & Lt; XSL: otherwise & gt; & Lt ;! - Your desired template - & gt; & Lt; Item & gt; & Lt; Xsl: select value = "$ string" /> & Lt; / Item & gt; & Lt; / XSL: otherwise & gt; & Lt; / XSL: Select & gt; & Lt; / XSL: If & gt; & Lt; / XSL: Templates & gt; & Lt; / XSL: stylesheet & gt;  

Result:

  & lt; Secuence & gt; & Lt; Item & gt; Item 1 & lt; / Item & gt; & Lt; Item & gt; ITEM2 & lt; / Item & gt; & Lt; Item & gt; ITEM3 & lt; / Item & gt; & Lt; / Secuence & gt;  

Comments