XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Kurt MartinSubject: RegEx Search and Replace
Author: Kurt Martin
Date: 31 Jan 2007 08:47 AM
Is there a way to use the Find/Replace feature in SS to only replace an expression within certain tags? For instance, I have <para> tags at different levels of the document, is there a way to remove all carriage returns ONLY within para tags?

Postnext
Alberto MassariSubject: RegEx Search and Replace
Author: Alberto Massari
Date: 31 Jan 2007 01:53 PM
Hi Kurt,
unfortunately that's not possible out of the box (you can only instruct the Search & Replace to work on the text nodes, all of them).
You could try using an XSLT stylesheet...

Sorry,
Alberto

Postnext
Kurt MartinSubject: RegEx Search and Replace
Author: Kurt Martin
Date: 01 Feb 2007 09:27 AM
So what would the template look like? I am not sure what the unicode string is for carriage return?

Thanks for your help.

Postnext
Alberto MassariSubject: RegEx Search and Replace
Author: Alberto Massari
Date: 01 Feb 2007 03:22 PM
Hi Kurt,
you can run this stylesheet on your XML file, using Saxon

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:strip-space elements="para"/>

<xsl:template match="/">
<xsl:copy-of select="."/>
</xsl:template>

</xsl:stylesheet>

Hope this helps,
Alberto

Postnext
Kurt MartinSubject: RegEx Search and Replace
Author: Kurt Martin
Date: 02 Feb 2007 10:35 AM
I tried this before, but tried it with the built-in, MSXML4 and Saxon 8.7.3 processors. It changes nothing. I tried the find-and-replace in SS (\r\n) you suggested before, but for some strange reason, it does NOT work in the para elements(?!?!?). It works in every other place. Even elements that are child elements to para it works.

Thanks for the information anyway.

Kurt

Posttop
Alberto MassariSubject: Re: RegEx Search and Replace
Author: Alberto Massari
Date: 05 Feb 2007 05:02 AM
Hi Kurt,
could attach the file with a sample of the "para" tag? Maybe it
doesn't use a normal line feed...

Alberto

 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.