-1

I am working on an XQuery script that takes the context of the Schematron rule and the body of the assert to generate a report as an excel spreadsheet.

It is so that what the Schematron validates actually meets the business requirements.

Does anyone have an XPath to business English translator?

Loren Cahlander
  • 1,257
  • 1
  • 10
  • 24
  • "Does anyone have an XPath to business English translator?" --- That's called a _Software Developer_. – zx485 Feb 12 '18 at 20:12
  • SO is for coding questions: you need to specify the input and the corresponding output. At the moment, you are asking for magic. So I'll downvote and vote to close. – Michael Kay Feb 12 '18 at 23:44

3 Answers3

0

Xpath is like an address - when you have good locators on a page (IDs, Names or classes) they are informative and helpful. Probably that is what any person could understand:

//*[id='next-page-button']

or

//button[@class='delete-order']

But having large relative locators is like describing address in that way: Hey, go 2 blocks forward, turn to the right, move 3 more blocks, and 4th house after the green one is yours - it is not easy to understand this, right?

Same with locators =) Even business people will understand simple locators with a small reference, like this: https://data-lessons.github.io/library-webscraping/extras/xpath-cheatsheet.md.pdf

Vitaliy Moskalyuk
  • 2,463
  • 13
  • 15
0

Business people are about as varied as the general population: some of them, for example, understand basic logic and some don't. If they don't understand basic logic then you're probably out of luck: you need to wave your arms around and draw pictures to communicate with them. If they do understand basic logic, then in my experience they are quite likely to understand XPath expressions like

every $product in //product[exists(@discount)]
satisfies $product/@discount < 0.1 * $product/@price

If you don't think they will understand that, then perhaps you should tell us what you think they would understand: because then we have the beginnings of a requirements specification.

Michael Kay
  • 156,231
  • 11
  • 92
  • 164
0

I was looking for something like:

declare function local:parse-xpath($xpath as xs:string) as xs:string
{
fn:normalize-space(
   fn:replace(
       fn:replace(
           fn:replace(
               fn:replace(
                   fn:replace(
                       fn:replace(
                           fn:replace(
                               fn:replace(
                                   fn:replace(
                                       $xpath,
                                       '\[not\(\*\)\]',
                                       ' with no child elements '
                                   ),
                                   'not\(\*\)',
                                   ' there are no child elements '
                               ),
                               '\*',
                               ' any element '
                           ),
                           '\.',
                           ' this element '
                       ),
                       '@',
                       ' attribute '
                   ),
                   '\]\[',
                   ' and '
               ),
               '\[',
               ' where '
           ),
           '\]',
           ' '
       ),
       '//',
       ' any depth where '
   )
)
};
Loren Cahlander
  • 1,257
  • 1
  • 10
  • 24