Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8059619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:43:47+00:00 2026-06-05T09:43:47+00:00

I have XML like this: <a> <b> <c>some text here</c> </b> </a> <a> <b>

  • 0

I have XML like this:

<a>
  <b>
    <c>some text here</c>
  </b>
</a>
<a>
  <b>
    <c>another cool text</c>
  </b>
</a>

I need to match word “cool” inside //a/b/c/text() and transform the XML like this

<a>
  <b>
    <c>some text here</c>
  </b>
</a>
<x>
  <y> prepend to cool text </y>
</x>
<a>
  <b>
    <c>another cool text</c>
  </b>
</a>

I tried this:

<xsl:template
        match="//a/b/c/matches(text(),'\.*cool\*.')">
...
</xsl:template>

but with no luck:

XTSE0340: XSLT Pattern syntax error at char 153 on line 30 in {...\.*cool\*...}:
  Function call may appear only at the start of a pattern

what am I missing here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T09:43:49+00:00Added an answer on June 5, 2026 at 9:43 am

    Your match is not correct, it should test inside brackets []:

    <xsl:template
            match="//a/b/c[matches(text(), '.*cool.*')]">
    ...
    </xsl:template>
    

    Besides, if your regexp is that easy, then you can use the XPath method contains().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have some xml like this: <mynode> <mysubnode> <mysubsubnode>hello world</mysubsubnode> some more text
I have an snippet XML like this: .... <cell type='1'> <A>Some text</A> </cell> <cell
I have an XML file formatted like <paragraph> Some Free text goes here<LinkType1 href=link1
I have some text like this: i18n_en_it_IT.xml:<li>risalire all&\#39;autore.</li> and like this (note the escaped
Let's suppose I have xml like this one: <Server Active=No> <Url>http://some.url</Url> </Server> C# class
I have some xml like this: <Data> <Rows> <Row> <Field Name=title>Mr</Field> <Field Name=surname>Doe</Field> <Row>
I have some XML which contains records and sub records, like this: <data> <record
I have some data in an XML element that looks like this: <?xml version=1.0
I have XML like this: <article> <title>Article 1 title</title> <text>Lorem ipsum...</text> <image>http://example.com/img_01.jpg</image> </article> <article>
I have a XML file, that looks like this inside: <Data> <INFO> .. ...

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.