[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] RE: replace < and > with < and >
Subject: [xsl] RE: replace < and > with < and > From: Dimitre Novatchev <dnovatchev@xxxxxxxxx> Date: Fri, 20 Sep 2002 03:31:40 -0700 (PDT) |
--- "bryan" <bry at itnisk dot com> wrote: > RE: replace < and > with < and > > From: "bryan" <bry at itnisk dot com> > To: <xsl-list at lists dot mulberrytech dot com> > Date: Fri, 20 Sep 2002 12:10:32 +0200 > Subject: RE: [xsl] replace < and > with < and > > Reply-to: xsl-list at lists dot mulberrytech dot com > > -------------------------------------------------------------------------------- > > >> The xml file is returned from a method is in a string format, > >> and the xml > >> file seems to encode all < and > using < and >. So, > >> what I need to do > >> is to convert that xml file from a string to a xml nodelist > >> so I can access > >> all the elements. > > >No, you need to correct the program that is generating the XML so > that > >it does it properly. > > Funny enough I'm dealing with the same problem, the problem in my > case > is caused by msxml's screwy philosophy of extension functions, i.e > that > the function can only return text, thus if you have an extension > function that returns an rtf, for example if you wrote an improved > document() with some decent error handling you're screwed cause your > xml > is gonna be text with a lot of <>. > > So basically one can do the following <xsl:value-of > select="myfunc:func('http://www.example.com/example.xml')" > disable-output-escaping="yes"/> to get the xml out of the extension > function. Can one then do the following: > <xsl:variable name="nodeset"><result><xsl:value-of > select="myfunc:func('http://www.example.com/example.xml')" > disable-output-escaping="yes"/> </result></xsl:variable> > > <xsl:apply-templates select="msxsl:node-set($nodeset)/result"/>? > > nope. > > If I want the xml processed, or you want the xml processed as far as > I > have found, I suppose one will have to do the processing inside the > extension function, by perhaps loading in myfunc_func.xsl and > processing > that xml inside the extension function, returning an rtf to the > function > which then converts the whole thing to text and then going ahead and > converting it back to xml via <xsl:value-of > select="myfunc:func('http://www.example.com/example.xml')" > disable-output-escaping="yes"/>. > > Anyway this is what I was thinking about doing to solve my particular > problem, if I still feel like solving it, not sure if it's worth it. > > By the way, If anyone else has a better solution for getting an rtf > out > of an msxml extension function please tell me. Hi Bryan, It is extremely easy to return a ***regular node-set*** from an extension function of MSXML3/4. I am not aware of any way to "return an RTF" from an extension function. By definition, an RTF is always created by the XSLT processor -- not from extension functions. For an example of an extension function returning a node-set, do have a look at the VB source code of the XSL Calculator, described at: "An XSL Calculator: The Math Modules of FXSL" http://fxsl.sourceforge.net/articles/xslCalculator/The%20FXSL%20Calculator.html#6._Putting_it_All_Together_-_the_XSLT_Calculator The dispResult() method of the extension object I'm using there is returning a node-set -- the xml representation of a request for performing a calculation. It is defined in the following way: Public Function dispResult(strResult As Variant) As IXMLDOMNodeList Dim strArg1 As String, strXML As String Dim xmldoc As New MSXML2.FreeThreadedDOMDocument40 Dim strOp As String frmCalc.txtUser = strResult frmCalc.Show vbModal strOp = frmCalc.strOp strXML = "<calc><op>" & strOp & "</op>" & _ "<arg>" & frmCalc.strArg1 & "</arg>" & _ "<arg>" & frmCalc.strArg2 & "</arg></calc>" xmldoc.loadXML strXML Set dispResult = xmldoc.selectNodes("/") End Function In the stylesheet, which calls this method, no further conversion is necessary -- it just uses the returned node-set as node-set. Hope this helped. ===== Cheers, Dimitre Novatchev. http://fxsl.sourceforge.net/ -- the home of FXSL __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Variable access, David Carlisle | Thread | [xsl] Formatted output, Satish, L. Gnanendra |
Re: [xsl] replace < and > wit, David Carlisle | Date | Re: [xsl] Variable access, Jeni Tennison |
Month |