<xsl:variable name="groups" as="element(group)*">
<xsl:analyze-string regex="^^([0-9-]+)([A-Z ]*)[ ]*([\(](.*)[\)])*$" select="/fault/informations/restriction1">
<xsl:matching-substring>
<group>
<x><xsl:value-of select="regex-group(1)"/></x>
<y><xsl:value-of select="regex-group(4)"/></y>
</group>
</xsl:matching-substring>
</xsl:analyze-string>
</xsl:variable>
it was allready in XSL Analyze-String -> Matching-Substring into multiple variables
but my question is how to use it on example to concate eg regex-group(1) with other element outside regex path "/fault/informations/restriction2"
so simple IMPUT XML:
<fault >
<information>
<reference1>22-00 X (AA - 03 StoLAT)</reference1>
<opr>Sample sam (66-33) Sample</opr>
</information>
</fault>
and OUTPUT I would like to have in one element
<mytrouble>
<trouble12>AA - 03 StoLAT , Sample sam Sample</trouble12>
</mytrouble>
so the rgex group 4 - text inside ( ) from <reference1>
and the whole text from opr
ps currently by transforming:
Cannot match item type with required type Error location: xsl:stylesheet / xsl:template / xsl:element / xsl:variable / @as
Details XTTE0570 : The required item type of variable ' groups ' is ' element(Q{http://xml.event/1.0}group) ' , the supplied item type is ' text() '
GREAT THANX for
michael.hor257k
almost there - just the result indicates header
<trouble12 xmlns:fn="http://www.w3.org/2005/xpath-functions">AA - 03 StoLATSample sam Sample</trouble12>
xmlns:fn="http://www.w3.org/2005/xpath-functions"
? – michael.hor257kxsl:stylesheet
opening tag, and you need to addexclude-result-prefixes="fn"
in the same place. – michael.hor257k