You need XPath 3.0 (XSLT 3.0) for this. Just use:
parse-xml(concat(/*/b1, /*/b2))/*/Ref/text()
You also need to correct the text inside the CDATA sections -- it contains </Tp>
-- a closing tag that has no corresponding starting tag. I corrected this to: <Tp/>
.
With this correction to the provided XML document, it is now:
<a>
<b1><![CDATA[<CdtrRefInf><Issr>XXX</Issr></Tp><Ref>123456123]]></b1>
<b2><![CDATA[193</Ref></CdtrRefInf>]]></b2>
</a>
The evaluation of the above XPath 3.0 expression on the above XML document produces the wanted, correct result:
123456123193
I verified this with BaseX using this XQuery 3.0:
let $top :=
<a>
<b1><![CDATA[<CdtrRefInf><Issr>XXX</Issr><Tp/><Ref>123456123]]></b1>
<b2><![CDATA[193</Ref></CdtrRefInf>]]></b2>
</a>
return
parse-xml(concat($top/b1, $top/b2))/*/Ref/text()
II. Solution in XSLT 2.0
XSLT 2.0 doesn't provide a simple function or instruction to parse a string into an XML document/fragment.
In Saxon, one may use the saxon:parse() extension function:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:saxon="http://saxon.sf.net/">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="/*">
<xsl:copy-of select="saxon:parse(concat(/*/b1, /*/b2))/*/Ref/text()"/>
</xsl:template>
</xsl:stylesheet>
When this transformation is performed with Saxon 9.1.07 on the provided XML document:
<a>
<b1><![CDATA[<CdtrRefInf><Issr>XXX</Issr><Tp/><Ref>123456123]]></b1>
<b2><![CDATA[193</Ref></CdtrRefInf>]]></b2>
</a>
the wanted, correct result is produced:
123456123193