troubleshooting Question

XsltArgumentList tryint to pass a value parameter

Avatar of TransBind
TransBind asked on
.NET ProgrammingC#ASP.NET
1 Comment1 Solution377 ViewsLast Modified:
In my code I am trying to pass a value to ItemElement parameter, the value is "Context" when I do that it treats       <xsl:value-of select="$ItemElement"/> as string and my output looks like

Context<br>
<li>Lorenzo Romano: 8-455-5640

it should look like
TEXT FROM XML FILE<br>
<li>Lorenzo Romano: 8-455-5640


<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:param name="ItemElement"></xsl:param>

  <xsl:template match="/">
    <xsl:for-each select="Events/CentralValley/OfficesCenters/Location">
      <br/>
      <xsl:value-of select="$ItemElement"/>
      <br/>
      <li>
        <xsl:value-of select="Item"/>
      </li>
    </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>



string EventSelected = (string)context.Items["EventSelected"].ToString();

                StringWriter StringWriter = new StringWriter();
               
                XslCompiledTransform XsltTransformation = new XslCompiledTransform();
               
                XsltArgumentList XsltArgumentList = new XsltArgumentList();
                XsltArgumentList.AddParam("ItemElement", String.Empty, "Context");

                string StylesheetPath = "global/_xml/Events.xslt";
                string SitemapPath = "global/_xml/Events.xml";

                try
                {
                    XsltTransformation.Load(Server.MapPath(StylesheetPath));
                    XsltTransformation.Transform(Server.MapPath(SitemapPath), XsltArgumentList, StringWriter);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                litEventContent.Text = StringWriter.ToString();
ASKER CERTIFIED SOLUTION
UnexplainedWays

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros