OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] matching text with regexp in xpath

[ Lists Home | Date Index | Thread Index ]

> ------_=_NextPart_001_01C23EBE.9040997A
> Content-Type: text/plain;
> 	charset="iso-8859-1"
> 
> Hi,
> 
> I was wondering if anybody knows of an extension function to XPath which
> allows me to match text and attribute values in XML documents against
> regular expressions.  I'd like to be able to write something like:
> 
> 	/a/b[re:match(@c, '{.}')]
> 
> to match all elements where an attribute has a value matching the regexp {.}
> (AVT) or:
> 
> 	/a/b/@c[re:match(., '{.}')]
> 
> to match the attribute elements themselves.
> 
> If there isn't such a thing yet I imagine it shouldn't be to hard to write.
> Can somebody give me some hints/directions on how to get started with this?

It depends on your XSLT processor.  4Suite comes with this built in.  It's 
called "f:match".


-- 
Uche Ogbuji                                    Fourthought, Inc.
http://uche.ogbuji.net    http://4Suite.org    http://fourthought.com
Track chair, XML/Web Services One Boston: http://www.xmlconference.com/
Basic XML and RDF techniques for knowledge management, Part 7 - 
http://www-106.ibm.com/developerworks/xml/library/x-think12.html
Keeping pace with James Clark - http://www-106.ibm.com/developerworks/xml/libra
ry/x-jclark.html
Python and XML development using 4Suite, Part 3: 4RDF - 
http://www-105.ibm.com/developerworks/education.nsf/xml-onlinecourse-bytitle/8A
1EA5A2CF4621C386256BBB006F4CEC






 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS