Subject: RE: [xsl] String manipulations with quotes From: "Ross Ken" <Ken.Ross@xxxxxxxxxxxxxx> Date: Fri, 11 Apr 2003 08:48:38 +1000 |
Try a recursive template. For example (untested code) <xsl:template match="text()" name="remove-quotes"> <xsl:param name="input" select="."/> <xsl:variable name="quote" select='"'/> <xsl:choose> <xsl:when test="contains($input,$quote)"> <xsl:call-template name="remove-quotes"> <xsl:with-param name="input" select="concat(substring-before($input,$quote),'"e;',substring-after($input,$quote))"/> </xsl:when> <xsl:otherwise><xsl:value-of select="$input"/></xsl:otherwise> </xsl:choose> </xsl:template> HTH, Ken Ross Ph: +61 7 32359370 Mob: +61 (0)419 772299 Email: Ken.Ross@xxxxxxxxxxxxxx -----Original Message----- From: Betty Harvey [mailto:harvey@xxxxxxxxxx] Sent: Friday, 11 April 2003 8:22 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: [xsl] String manipulations with quotes I don't have control over the authoring. The quotes are already embedded in the file. I can't change all the " to the character entity because it would change them all. I could bring the file into XMetal and convert the quotes with a global find and replace. However, the file is 8 megabytes long. I could probably do this and start the search and replace this evening and maybe it will be finished in the morning |-). It just seems like this should be doable in XSLT. Betty /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ Betty Harvey | Phone: 410-787-9200 FAX: 9830 Electronic Commerce Connection, Inc. | harvey@xxxxxxxxxx | Washington,DC XML Users Grp URL: http://www.eccnet.com | http://www.eccnet.com/xmlug /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\\/\/ On Thu, 10 Apr 2003, David Christiansen wrote: > Here is a table I put together for reserved symbols. The semicolon > afterwards is required > Char String > ------- ---------- > & & > < < > > > > ' ' > " " > > -----Original Message----- > From: Betty Harvey [mailto:harvey@xxxxxxxxxx] > Sent: Thursday, April 10, 2003 3:53 PM > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] String manipulations with quotes > > > > I am trying to grab text within quotes. XSLT is not being cooperative. > Does anyone have any tricks to grab the quote. I would expect it would see > the double quote in the single quote as 'text' and not a delimiter. > However, it sees it as a closing quote. I tried the 'old vi backslash > trick'but it didn't work. If it helps, here is my 'snippet'. > > <xsl:variable name="name1"> > <xsl:value-of select="substring-after ($definition, '"')"/> > </xsl:variable> > <xsl:variable name="name2"> > <xsl:value-of select="substring-before ($name1, '"')"/> > </xsl:variable> > > TIA. > > Betty > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > -- XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list -------------------------------------------------------------------------------------------------------------------------- IMPORTANT: This email (including any attachments) may contain confidential, private or legally privileged information and may be protected by copyright. You may only use it if you are the person(s) it was intended to be sent to and if you use it in an authorised way. No one is allowed to use, review, alter, transmit, disclose, distribute, print or copy this e-mail without appropriate authority. If this e-mail was not intended for you and was sent to you by mistake, please telephone or e-mail me immediately, destroy any hard copies of this e-mail and delete it and any copies of it from your computer system. Any legal privilege and confidentiality attached to this e-mail is not waived or destroyed by that mistake. It is your responsibility to ensure that this e-mail does not contain and is not affected by computer viruses, defects or interference by third parties or replication problems (including incompatibility with your computer system). XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] String manipulations with, David Carlisle | Thread | [xsl] template match for subelement, Kathy Burke |
[xsl] template match for subelement, Kathy Burke | Date | Re: [xsl] How to use an xml Element, bix xslt |
Month |