Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
XML
XLST2 and stringmanipulation
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Andreas Kraftl, post: 776372"] Hello, i've a xml file: <lexikon> <begriff> <synonyme> <synonym>a</synonym> <synonym>b c</synonym> </synonym> <beschreibung> Great letters. </beschreibung> </begriff> ... </lexikon> Then there is an other XML file where i would every string from <synonym> extending. Example XML file: There is an b c and there an a should be extend to There is an <a href="lexikon.php" class="lexikon">b c<span> Great letters.</span></a> and there an <a href="lexikon.php" class="lexikon">a<span> Great letters.</span></a> Following works not: <!-- build the regex string --> <xsl:variable name="lexwordstring"> <xsl:text>(.*?)(nurDummText</xsl:text> <xsl:for-each select="/pages/page/content/lexikon/begriff/synonyme/*"> <xsl:text>|</xsl:text> <xsl:value-of select="normalize-space(.)"/> </xsl:for-each> <xsl:text>)([ ,.]*?)</xsl:text> </xsl:variable> <xsl:template match="text()"> <xsl:analyze-string select="." regex="{$lexwordstring}"> <xsl:matching-substring> <xsl:value-of select="regex-group(1)"/> <a href="{$lexikonpage}" class="lexikon"> <xsl:value-of select="regex-group(2)"/> <span> <xsl:apply-templates select="..."/> </span> </a> </xsl:matching-substring> <xsl:non-matching-substring> <xsl:value-of select="."/> </xsl:non-matching-substring> </xsl:analyze-string> </xsl:template> Saxon means with <xsl:apply-templates> "Cannot select a node here: the context item is an atomic value" Without <xsl:apply-templates>, it works, but without the description ;). Every idea is welcome? Thanks Andy [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
XML
XLST2 and stringmanipulation
Top