Search code examples
xsltdita

Get text in String using XSLT


Get text in String using XSLT

Input :

<chapter href="Sapmle_text" format="ditamap"
otherprops="navlabel(Reading) navnum(41)" class="- map/topicref bookmap/chapter ">

Output should be:

41

Tried Xpath:

//xref[parent::p/following-sibling::fig]/ancestor::chapter/substring-after(@outputclass,'navnum(')

But my tried code is not working properly. How can I get 41 from chapter element?

I am using XSLT 2.0


Solution

  • Try:

    chapter/substring-before(substring-after(@otherprops, 'navnum('), ')')