Subject: RE: [xsl] How do you get the non-transformed character entity out of MSXML3.0 From: jdgarrett@xxxxxxxxxx Date: Sun, 16 Sep 2001 13:53:28 -0500 |
Julian (and thanks again Chris ) Julian problem (which Chris has enlightened me about,) is I want the value of the attribute or the element before transformation so that it can be inserted into another xml structure so that new xml structure is "loadable" by the dom via visual basic..."without" having to do the string manipulation that Chris provided in his first reply .....this way new xml and subsequent xml structures can be loaded in the dom via visual basic and passed around between vb COM objects until the final xml structure is transformed via the transformnode method in vb and sent out to the requesting browser as HTML .... the issue is keeping and accessing the value < (or other character entities) in their untransformed state (whether as an attribute value or a node value) when passing between vb COM objects without having to resort to additional string manipulations.... I have a simple vb function that will detransform a node or attribute value when the submitting browser submits a html form... using a simple replace function e.g. Function Detransform(submittedString) as string submittedString = replace(submittedString, "<", "<) submittedString = replace(submittedString, ">", ">) submittedString = replace(submittedString, "&", "&) submittedString = replace(submittedString, "'", "') submittedString = replace(submittedString, """","") Detransform = submittedString End Function now after the destransform occurs I did not want to have to run the xml through the above again every time the xml structure was loaded by the MSXML parser inside of all the vb COM objects that handle the XML structure on the way to the SQL db and back up the vb COM chain to the vb IIS application that does the final transformation into HTML and then response.write it out to the requesting browser... Now that Chris has informed me that it is not possible to access only the value rather than the value and the attribute name via MSXML from visual basic I will have to call the Detransform function every time the xml structure is loaded and the attribute value is accessed ... given (again) <Customer number="125487" NumberOfPurchases="<4" >Joe & Bill's Shop</Customer> It would be nice if the Detransform function was a native method inside the MSXML parser so that I could just access the detransformed value of the attribute .. dim stringDetransformedValue stringDetransformedValue = xml.selectSingleNode("/Customer/@NumberOfPurchases").xmlAttributeValueNotTra nsformed which would return only <4 rather than NumberOfPurchases="<4" Bottom line .... I must then have an external from parser function given <Customer number="125487" NumberOfPurchases="<4" >Joe & Bill's Shop</Customer> '//call vb function result = ReturnAttributeValueOnly(xml.selectSingleNode("/Customer/@NumberOfPurchases" ).xml) Function ReturnAttributeValueOnly(ByVal stringPassedIn) As String Dim string1 As String Dim position1%, position2% position1% = InStr(1, stringPassedIn, """", 1) position2% = InStrRev(stringPassedIn, """") ReturnAttributeValueOnly = Mid$(stringPassedIn, position1 + 1, position2 - (position1 + 1)) End Function the returned value would then be <4 Well that is that I guess ...(hey MS wanna put a new function in the MSXML parser *s*) Thanks again Chris ....!!!!! |-----Original Message----- |From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx |[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Chris Bayes |Sent: Sunday, September 16, 2001 6:27 AM |To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx |Subject: RE: [xsl] How do you get the non-transformed character entity |out of MSXML3.0 | | |Julian, |Who knows what exactly the problem is here but suppose you wanted to do |something like find all records in a text file that match some attribute |in the dom. You can't do it. The text file might be a csv but with |escaped characters who knows but there are times when you want to get |"<4" from the dom so that you can match it to a record in a text |file. There is no way you can match a text record like |125487 <4 Joe & Bill's Shop |unless you can get the value "<4" out of the dom. | |Ciao Chris | |XML/XSL Portal |http://www.bayes.co.uk/xml | | |> -----Original Message----- |> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx |> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of |> Julian Reschke |> Sent: 16 September 2001 11:04 |> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx |> Subject: RE: [xsl] How do you get the non-transformed |> character entity out of MSXML3.0 |> |> |> Why would you want that? |> |> In XML, "less-than" is serialized as "<". |> |> When accessing the DOM, you get the "raw" character ("<"). |> |> Serializing the DOM again (using save() or the xml property) |> will turn it back into "<". |> |> I fail to see a problem here. | | | XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list | XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] How do you get the non-tr, Chris Bayes | Thread | RE: [xsl] How do you get the non-tr, Julian Reschke |
Re: XPath 2.0: Conditional Expressi, Trevor Nash | Date | RE: [xsl] How do you get the non-tr, Julian Reschke |
Month |