[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl][xslt v1.0] How to parse the string as node-set?


Subject: Re: [xsl][xslt v1.0] How to parse the string as node-set?
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Sun, 30 Sep 2012 07:36:11 -0700

Here is an example how to do this for a cspecific XSLT processor (.NET
XslCompiledTransform):

<xsl:stylesheet version="1.0"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:msxsl="urn:schemas-microsoft-com:xslt"
 xmlns:ex="http://xmlexchangeservice.com/"
 xmlns:my="my:my" exclude-result-prefixes="msxsl my">
	<xsl:output omit-xml-declaration="yes" indent="yes"/>
	
	<xsl:template match="/*">
		<xsl:copy-of select=
		 "my:parse(string(//ex:InputXML))//*[local-name()='Organization']"/>
	</xsl:template>

	<msxsl:script language="c#" implements-prefix="my">
		public XmlDocument parse(string text)
		 {    XmlDocument doc = new XmlDocument();
		      doc.LoadXml(text);
		      return doc;
     }
	 </msxsl:script>
</xsl:stylesheet>


produces:

<tns:Organization
xmlns:tns="urn:schemas:x12:org:V00200806:CoverageRequest"
xmlns:X12.7="urn:x12:schemas:V00200806:X12.7"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<tns:Name>Florida</tns:Name>
</tns:Organization>


Cheers,
Dimitre

On Fri, Sep 28, 2012 at 1:19 PM, Mak Praveen <praveenml@xxxxxxxxx> wrote:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
>             <soap:Body>
>                         <TransmitXML xmlns="http://xmlexchangeservice.com/">
>                                     <InputXML>&lt;?xml version="1.0"
> encoding="utf-8"?&gt;
>                 &lt;tns:CoverageRequest
> xmlns:X12.7="urn:x12:schemas:V00200806:X12.7"
> xmlns:tns="urn:schemas:x12:org:V00200806:CoverageRequest"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> PublicationVersion="00200809" PublicationDate="1984-02-12"&gt;
>                     &lt;tns:RequestorInformation&gt;
>                         &lt;tns:Organization&gt;
>                             &lt;tns:Name&gt;Florida&lt;/tns:Name&gt;
>                         &lt;/tns:Organization&gt;
>                         &lt;tns:ReasonDetails&gt;
>                             &lt;tns:ReasonCode&gt;ACCV&lt;/tns:ReasonCode&gt;
>                         &lt;/tns:ReasonDetails&gt;
>                     &lt;/tns:RequestorInformation&gt;
>                 &lt;/tns:CoverageRequest&gt;
>         </InputXML>
>         <XMLSchemaVersion>V00200806-ServiceRequest</XMLSchemaVersion>
> </TransmitXML>
> </soap:Body>
> </soap:Envelope>



-- 
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
To avoid situations in which you might make mistakes may be the
biggest mistake of all
------------------------------------
Quality means doing it right when no one is looking.
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
Facts do not cease to exist because they are ignored.
-------------------------------------
Typing monkeys will write all Shakespeare's works in 200yrs.Will they
write all patents, too? :)
-------------------------------------
I finally figured out the only reason to be alive is to enjoy it.


Current Thread
Keywords