|
Subject:
|
Replace command?
|
|
Posted By:
|
mcw22
|
Post Date:
|
8/21/2006 1:17:21 AM
|
I heard that it's possible to perform a replace command inside XML.
Suppose I have this line of code:
<replace var="$total$" regexp="<font size=-1>Results <b>([0-9]*)</b> - <b>([0-9]*)</b> of about <b>([^<]*)</b> replacement="(([^0-9]*),[]),$3 />
whereby I want to remove the commas for the third parenthesis (think 618,000,000 ----> 618000000)is that the right way or is there a better way to do that function above?
Thanks
|
|
Reply By:
|
mhkay
|
Reply Date:
|
8/21/2006 2:22:13 AM
|
XML is data, there are no commands in XML, so it's not clear what you mean here. There might be some language that supports a construct like the one you've written here, but if so, I haven't heard of it. Most languages that operate on XML, such as XSLT and XQuery, operate at the level of XML as a tree of nodes, not the lexical level of markup and angle brackets as featured in your sample.
The usual way of removing commas from a number would be the translate() function in XSLT/XPath.
Michael Kay http://www.saxonica.com/ Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
|