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

  • SEARCH
  • Home
  • 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 8193395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:28:06+00:00 2026-06-07T04:28:06+00:00

In my xslt i have a piece of C# code : public string CleanForTableTags(string

  • 0

In my xslt i have a piece of C# code :

public string CleanForTableTags(string pContent){

        string input = String.Concat("<root>", pContent, "</root>");

    System.Xml.Linq.XDocument doc = System.Xml.Linq.XDocument.Parse(input, System.Xml.Linq.LoadOptions.PreserveWhitespace);

    var valueWithinTags = doc.Root.Element("table").ToString();
    string[] values = Regex.Matches(valueWithinTags, @"<.*?>")
        .Cast<Match>()
        .Select(o => o.Groups[0].Value)
        .ToArray();

    System.Guid d = System.Guid.NewGuid();
    string s = pContent.Replace(valueWithinTags, d.ToString());

    return s;
}

as u can see i use: System.Xml.Linq

in my webconfig ive got :

    <compilation debug="true">
        <assemblies>
            <add assembly="WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
            <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Drawing.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
            <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies>
    </compilation>

And still i am getting :

The type or namespace name ‘Linq’ does not exist in the namespace ‘System.Xml’ (are you missing an assembly reference?)

What am i doing wrong?

I am using VS 2008. All paths to Dlls are correct, if i use same piese of code from a class it work without problems, but as soon it is used inside of xslt, im getting error

Next problem :

now its failing on

string[] values = Regex.Matches(valueWithinTags, @"<.*?>")
            .Cast<Match>()
            .Select(o => o.Groups[0].Value)
            .ToArray();



'System.Text.RegularExpressions.MatchCollection' does not contain a definition for 'Cast' and no extension method 'Cast' accepting a first argument of type 'System.Text.RegularExpressions.MatchCollection' could be found (are you missing a using directive or an assembly reference?)
  • 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-07T04:28:08+00:00Added an answer on June 7, 2026 at 4:28 am

    What do you mean exactly by “inside of xslt”?

    XSLT is just an xml file with transformations. Or are you using the msxsl namespace to include a piece of script using C#?

    In that case you probably need to include <msxsl:assembly name="System.Xml.Linq" />
    as well as using <msxsl:using namespace="System.Xml.Linq" /> inside the transformations file.

    Here’s an example of how to include a piece of script inside the transformation: http://docs.composite.net/FAQ/Developer?q=How+to+run+CSharp+function+in+XSLT%3F

    Regarding the second part, about Cast<>, that is an extension method in System.Linq.Enumerable so adding the System.Linq namespace as a “using” should suffice (also make sure System.Core is included as an assembly as well).

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

Sidebar

Related Questions

I have the following piece of code in my XSLT file: <xsl:copy-of select=/root/Algemeen/foto/node() />
I have an XSLT that is transformed to an XML using System.Xml.Xsl.XslCompiledTransform . The
I have a piece of XML that is structured similar to this: <root> <score
I have a XML structure like the following: <Root> <Node Name=File System> <Node Name=C:\Windows\System32\drivers\etc\hosts>
we have XSLT to transform XML into HTML in XHTML 1.0 Strict in XSLT
I have an XSLT in which I create (from the input data) intermediary variables
I have a .xslt that translates xml from one form to another (I'm not
I have an XSLT stylesheet that transforms an XML file to JSON format and
I have a terrible piece of XML that I need to process through BizTalk,
I have XSLT 1.0 code like this: <xsl:key name=enemyItems match=metadata[attributes/metadata_key/@value = 'enemylist'] use=attributes/metadata_refkey/@value/> <xsl:template

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.