Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to iterate through XML param in XSLT
    primarykey
    data
    text
    <p>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:</p> <pre><code>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("./*"); </code></pre> <p>My xml parameter looks like </p> <pre><code>&lt;root&gt;&lt;attachment xmlns=file1&gt;&lt;attachment xmlns=file2&gt;&lt;/root&gt; </code></pre> <p>Now in XSLT I need to iterate through this XML param and create a link.</p> <p>Here is my XSLT</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;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"&gt; &lt;xsl:param name="attachment"/&gt; &lt;xsl:for-each select="$attachment"&gt; &lt;a target="_blank" href="#"&gt;&lt;xsl:copy-of select="."/&gt;&lt;/a&gt; &lt;/xsl:for-each&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>But it doesn't create a link. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload