For a received Schema based XML document, I call a procedure that traverses a ruleset table filled with XPath expressions that if validate to true for values found within elements or attributes, the document is placed in a failed_rules table. The ruleset table is built using an unstructured xml document which is structured as:
<ruleset name="DocClassifications">
<rule name = "Document cannot contain SENSITIVE remarks">
/document/person/remark/co
</rule>
...
</ruleset>
What is necessary is use a conditional expression (if-then-else) that will check the attribute "code" for the value "S". If true then REPLACE the string in the element "remark" with another string - "Not available for this network."
Finding the value of an element or attribute is not a problem. Performing string manipulation (without XSLT) is.
What may be a solution is to CALL an external procedure to do the string replacement, but this is not preferred. I would like to handle it in a regex.
Can you help?
Main Topics
Browse All Topics





by: GertonePosted on 2009-05-06 at 15:15:25ID: 24320420
I am not sure I understand what you want.
attribute, '^S(ensitive)')]
XPath can't "replace" in a source XML, it can only address a location or return a value,
so can you tell a little bit about how you execute the XPath?
/element/element[matches(@
will get you the element that has this particular attribute