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 3982472
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:31:54+00:00 2026-05-20T05:31:54+00:00

I have an XML file that I am transforming via XSLT. I am passing

  • 0

I have an XML file that I am transforming via XSLT. I am passing an XML as parameter to the XSLT via C#. The parameter’s name is attachment and it contains XML. It is written as follows:

StringWriter sw = new StringWriter(); 
XmlTextWriter w = new XmlTextWriter(sw); 
w.WriteStartElement("root"); 
if (!string.IsNullOrEmpty(sWordFileName)) { 
    w.WriteStartElement("mylink", sWordFileName); 
    w.WriteEndElement(); 
}
if (!string.IsNullOrEmpty(sPDFFileName)) { 
    w.WriteStartElement("mylink", sPDFFileName);
    w.WriteEndElement();
}
w.Close();
XPathDocument doc = new XPathDocument(new StringReader(sw.ToString()));
XPathNavigator nav = doc.CreateNavigator();
_exportSet[currentExportSet].Format.ParamList["attachment"] = nav.Select("./*");

My xml parameter looks like

<root><attachment xmlns=file1><attachment xmlns=file2></root>

Now in XSLT I need to iterate through this XML param and create a link.

Here is my XSLT

<?xml version="1.0" encoding="utf-8"?> 
    <xsl:stylesheet version="2.0" xmlns:xsl="w3.org/1999/XSL/Transform"
        xmlns:msxsl="urn:schemas-microsoft-com:xslt" 
        xmlns:my-scripts="urn:my-scripts" 
        xmlns="factiva.com/fcs/schemas/newsSummaries">

        <xsl:param name="attachment"/>
        <xsl:for-each select="$attachment">  
            <a target="_blank" href="#"><xsl:copy-of select="."/></a>  
         </xsl:for-each>
     </xsl:stylesheet>

But it doesn’t create a link.

  • 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-05-20T05:31:55+00:00Added an answer on May 20, 2026 at 5:31 am

    An XSLT parameter is different than an XML tag name. Parameters are passed using the tag as described here.

    As stated in the comments below, this problem is not too different from what is provided in the link above.

    StringWriter sw = new StringWriter(); 
    XmlTextWriter w = new XmlTextWriter(sw); 
    w.WriteStartElement("root"); 
    if (!string.IsNullOrEmpty(sWordFileName)) { 
        w.WriteStartElement("attachment", sWordFileName); 
        w.WriteAttributeString("name", sWordFileName);
        w.WriteEndElement(); 
    }
    if (!string.IsNullOrEmpty(sPDFFileName)) { 
        w.WriteStartElement("attachment");
        w.WriteAttributeString("name", sPDFFileName);
        w.WriteEndElement();
    }
    w.WriteEndElement();
    w.Close();
    XPathDocument doc = new XPathDocument(new StringReader(sw.ToString()));
    XPathNavigator nav = doc.CreateNavigator();
    
    XsltArgumentList xslArg = new XsltArgumentList();
    xslArg.AddParam("attachment","",nav);
    

    Here would be XSL to match per Accessing parameters which contain mark-up:

    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="2.0" 
       xmlns:xsl="w3.org/1999/XSL/Transform"
       xmlns:msxsl="urn:schemas-microsoft-com:xslt" 
       xmlns:my-scripts="urn:my-scripts" 
       xmlns="factiva.com/fcs/schemas/newsSummaries">
        <xsl:param name="attachment" />
    
        <xsl:template match="/">
            <xsl:apply-templates select="$attachment"/>
        </xsl:template>
        <xsl:template match="attachment">
            <a target="_blank" href="{@name}">{@name}</a>
        </xsl:template>
    
    </xsl:stylesheet>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an XML file that looks like <?xml version=1.0> <playlist> <name>My Playlist</name> <song>
I have an XML file that looks like <?xml version='1.0' encoding='UTF-8'?> <root> <node name=foo1
I have a XML file that looks like this <Licence> <Name>Test company</Name> <Version>1.1.1.1</Version> <NumberOfServer>2</NumberOfServer>
I have an XML file that contains database settings that may change depending on
I have an xml file that contains a list of items i can deserialize
I have an xml file that contains in products. File's structure this: <?xml version=1.0
I have an XML file that contains a script of items to check and
I have xml file that contains the URLs for geocoding requests to Google. I
I have an xml file that is loaded via jquery to populate a jQuery
I have an XML file that starts like this: <Elements name=Entities xmlns=XS-GenerationToolElements> I'll have

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.