Skip to main content
1-Visitor
September 10, 2017
Solved

XPATH String

  • September 10, 2017
  • 1 reply
  • 2371 views

Hi, I would like to use the WC_VERSION_ATTR  Revision number in gentext.

I've got the attribute correct in arbortext via bursting rules (twoway). -> rev = WC_VERSION_ATTR

 

When I generate the text containing the rev (with xpath) is say as example: B.7

I would like the show only the Revision of the document: B (without the .7)

 

Is there a way to read the rev attribute and modify attribute ?

 

thanks in advance

christian

Best answer by GarethOakes

Hi Christian,

 

If you're already using XPath then good news, there is a function for this: https://developer.mozilla.org/en-US/docs/Web/XPath/Functions/substring-before

 

The following example should do the trick:

substring-before(/get/my/WC_VERSION_ATTR,".")

 

Replace /get/my/WC_VERSION_ATTR with your current XPath that retrieves "B.7", then the substring-before function will strip off everything after (and including) the full stop period dot.

 

My only concern is that you mention using two-way bursting. I don't think you can (or should) be modifying WC_VERSION_ATTR from the Arbortext side.

1 reply

16-Pearl
September 11, 2017

Hi Christian,

 

If you're already using XPath then good news, there is a function for this: https://developer.mozilla.org/en-US/docs/Web/XPath/Functions/substring-before

 

The following example should do the trick:

substring-before(/get/my/WC_VERSION_ATTR,".")

 

Replace /get/my/WC_VERSION_ATTR with your current XPath that retrieves "B.7", then the substring-before function will strip off everything after (and including) the full stop period dot.

 

My only concern is that you mention using two-way bursting. I don't think you can (or should) be modifying WC_VERSION_ATTR from the Arbortext side.

czaugg-21-VisitorAuthor
1-Visitor
September 12, 2017

Dear Gareth,

 

thank you for your input ,works fine ! substring-before(/RDStyle/ResolvedMap/techinfomap/@rev, '.'

 

Regarding the two-way bursting, according to PTC, WC_VERSION_ATTR is read-only and can be used only in a twowaymetadatarule burst configuration file rule where the mode is toxml.

 

Do you have make any bad experiance ?

 

Thank you

 

Christian

16-Pearl
September 12, 2017

That sounds all good, glad to hear you got it working now 🙂