Use XsltArgumentList to implement xsl parameter calling
Choose from hstod's Blog
xmlDocument XmlDoc=new XmlDocument(); XmlDoc.Load(strFilePath); XslTransform xslt = new XslTransform(); xslt.Load(strXslPath); XsltArgumentList xslArg = new XsltArgumentList(); xslArg.AddParam("Key1", "",IXPath); xslArg.AddParam("Path", "",strPath); StringBuilder sb = new StringBuilder(""); StringWriter sw = new StringWriter(sb); XmlTextWriter writer = new XmlTextWriter(sw); xslt.Transform(XmlDoc,xslArg,writer,null); writer.Close(); HXML.InnerHtml=sb.ToString();
This is an xsl file
<?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:param name="Key1"/> <xsl:param name="Path"/> <xsl:template match="/"> <xsl:apply-templates select="/DB/L[@Key=$Key1]" /> </xsl:template> <xsl:template match="L[@Type='1']"> <a target="_blank"> <xsl:attribute name="href"><xsl:value-of select="@Link" /></xsl:attribute> <img border="0"> <xsl:attribute name="width"><xsl:value-of select="@width" /></xsl:attribute> <xsl:attribute name="height"><xsl:value-of select="@height" /></xsl:attribute> <xsl:attribute name="src"><xsl:value-of select="$Path" />Res/AD/<xsl:value-of select="@File" /></xsl:attribute> </img> </a> </xsl:template> <xsl:template match="L[@Type='2']"> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/Flash/swflash.cab#version=6,0,29,0" > <xsl:attribute name="width"><xsl:value-of select="@width" /> </xsl:attribute> <xsl:attribute name="height"><xsl:value-of select="@height" /> </xsl:attribute> <param name="movie"> <xsl:attribute name="value"><xsl:value-of select="$Path" />Res/AD/<xsl:value-of select="@File" /> </xsl:attribute> </param> <param name="quality" value="high"/> <embed quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"> <xsl:attribute name="width"><xsl:value-of select="@width" /> </xsl:attribute> <xsl:attribute name="height"><xsl:value-of select="@height" /> </xsl:attribute> <xsl:attribute name="src"><xsl:value-of select="$Path" />Res/AD/<xsl:value-of select="@File" /> </xsl:attribute> </embed> </object> </xsl:template> </xsl:stylesheet>
xml file
<?xml version="1.0" encoding="GB2312"?> <DB> <L Name="测试1" height="100" width="100" Link="http://www.123.com" File="20056171345164340.gif" Key="200561713451653143405" Type="1" /> </DB>
The above is the content of using XsltArgumentList to implement xsl parameter call, more related Please pay attention to the PHP Chinese website (www.php.cn) for content!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











XML has the advantages of structured data, scalability, cross-platform compatibility and parsing verification in RSS. 1) Structured data ensures consistency and reliability of content; 2) Scalability allows the addition of custom tags to suit content needs; 3) Cross-platform compatibility makes it work seamlessly on different devices; 4) Analytical and verification tools ensure the quality and integrity of the feed.

The steps to build an RSSfeed using XML are as follows: 1. Create the root element and set the version; 2. Add the channel element and its basic information; 3. Add the entry element, including the title, link and description; 4. Convert the XML structure to a string and output it. With these steps, you can create a valid RSSfeed from scratch and enhance its functionality by adding additional elements such as release date and author information.

RSS documents work by publishing content updates through XML files, and users subscribe and receive notifications through RSS readers. 1. Content publisher creates and updates RSS documents. 2. The RSS reader regularly accesses and parses XML files. 3. Users browse and read updated content. Example of usage: Subscribe to TechCrunch's RSS feed, just copy the link to the RSS reader.

The steps to create an RSS document are as follows: 1. Write in XML format, with the root element, including the elements. 2. Add, etc. elements to describe channel information. 3. Add elements, each representing a content entry, including,,,,,,,,,,,. 4. Optionally add and elements to enrich the content. 5. Ensure the XML format is correct, use online tools to verify, optimize performance and keep content updated.

The XML structure of RSS includes: 1. XML declaration and RSS version, 2. Channel (Channel), 3. Item. These parts form the basis of RSS files, allowing users to obtain and process content information by parsing XML data.

Advanced features of RSS include content namespaces, extension modules, and conditional subscriptions. 1) Content namespace extends RSS functionality, 2) Extended modules such as DublinCore or iTunes to add metadata, 3) Conditional subscription filters entries based on specific conditions. These functions are implemented by adding XML elements and attributes to improve information acquisition efficiency.

The implementation of RSS in XML is to organize content through a structured XML format. 1) RSS uses XML as the data exchange format, including elements such as channel information and project list. 2) When generating RSS files, content must be organized according to specifications and published to the server for subscription. 3) RSS files can be subscribed through a reader or plug-in to automatically update the content.

RSS is an XML-based format used to publish and subscribe to content. The XML structure of an RSS file includes a root element, an element, and multiple elements, each representing a content entry. Read and parse RSS files through XML parser, and users can subscribe and get the latest content.
