Linux 软件免费装

Ten&Two XSLT Processor

开发者 tenandtwo
更新时间 2024年4月30日 06:36
PHP版本: 7.4 及以上
WordPress版本: 6.5
版权: GPLv2 or later
版权网址: 版权信息

标签

shortcode xml csv xsl xslt

下载

1.0.4 1.0.5 1.0.0 1.0.1 1.0.2 1.0.3

详情介绍:

The Ten&Two XSLT Processor plugin brings the power of PHP's XSL extension to Wordpress. Once enabled, the plugin creates three (3) shortcodes - [xslt_transform_xml/], [xslt_select_xml/], and [xslt_select_csv/] - which can be used separately or in tandem to enrich your site with content from XML and CSV sources. The plugin also enables two (2) custom post types - XSL Stylesheets and XML Documents - for managing and validating sources within WP Admin. Detailed documentation and sample code can be found at https://xsltproc.tenandtwo.com/ Custom Post Types The XSLT Processor plugin provides two (2) custom post types for managing sources within Wordpress - XSL Stylesheets and XML Documents. Both types include basic syntax validation. XML Documents can be validated further using DTD, XSD, or RNG. Both types are enabled in Settings > XSLT Processor > Activate Content Types. Shortcode : [xslt_transform_xml/] [xslt_transform_xml/] is the plugin's primary function. This shortcode processes XML data using an XSL stylesheet, and then outputs the result as HTML, more XML, or as simple TEXT. If either the xsl or xml parameter is left unspecified, defaults are used. The default XML value is <NODATA/>. The default XSL stylesheet prints all of the incoming data as HTML. If extra attributes are specified in the shortcode - eg, mykey="myval" - those keys/values are passed along as parameters to the stylesheet - <xsl:param name="mykey"/>. Shortcode : [xslt_select_xml/] [xslt_select_xml/] is a helper function. It reads XML and returns a selection of the data, based on a supplied XPath expression. There are two (2) options for specifying the XPath. First, using the select attribute or, second, using the body of the shortcode. Complex select statements with quotes, square brackets or other special syntax, should use the second pattern : If the XPath select parameter is left unspecified, the default / is used, which returns the entire document. The default output is format="xml". If format="json" is specified, the result is encoded as a JSON string. Shortcode : [xslt_select_csv/] [xslt_select_csv/] is a helper function for converting CSV file data to XML. The result can be output directly as an HTML <table>, or the result can be passed to [xslt_transform_xml/] for further processing. Three (3) parameters - separator, enclosure, escape - control reading the input. See PHP's fgetcsv() function for details. Two (2) parameters - key_row, col - control writing columns to the output. The key_row attribute is optional, but allows labels from that row to be used in col and key_col. Three (3) parameters - row, key_col, key - control writing rows to the output. Nested Shortcodes Combine [xslt_transform_xml] with [xslt_select_xml] : Combine [xslt_transform_xml] with [xslt_select_csv] : Combine [xslt_transform_xml] with itself using [/xslt_transform_alias] (WP does not support nested shortcodes with identical names) : Combine multiple shortcodes/sources to create a single XML Document (see Custom Post Types above) : Cache Parameters When a shortcode specifies a remote file - xml="{url}" or csv="{url}" - that source is cached locally using WP Transients. The default cache duration is set in the XSLT Processor Settings. To override the default, add cache="{minutes}" to the shortcode. Namespace Parameters Within [xslt_select_xml/] the plugin provides two (2) methods for handling XML containing namespaces. The first is to add strip-namespaces to the shortcode. The second method is to add the needed prefixes and namespace URIs using xslns. WP-CLI All three (3) shortcodes have command-line equivalents. They can be used, for instance, to run quick tests. Or they can be used, by piping the outputs into files, to pre-generate results. XSL Stylesheets The XSLT Processor plugin includes a number of useful XSL templates that you can include and use in your own projects. They are grouped into five files.

安装:

WordPress installation
  1. Go to Plugins > Add New > Search for "tenandtwo-xslt-processor"
  2. Press "Install Now" for the "Ten&Two XSLT Processor" plugin
  3. Press "Activate Plugin"
WP-CLI installation
  1. wp plugin install tenandtwo-xslt-processor --activate
Manual installation
  1. Download the latest archive from the Plugin Homepage : https://wordpress.org/plugins/tenandtwo-xslt-processor
  2. Upload the tenandtwo-xslt-processor directory to your /wp-content/plugins/ directory
  3. Activate the plugin through the "Plugins" menu in WordPress
For more details on installation options, see Manage Plugins at wordpress.org - https://wordpress.org/documentation/article/manage-plugins/ Requirements The Ten&Two XSLT Processor plugin relies upon PHP's XSL extension. If the extension is installed, the XSLT Processor Settings screen will display a message similar to the first message below. If LIBXSLT_VERSION is undefined, all plugin options are disabled automatically and the second message is displayed. The XSL extension's requirements are detailed at php.net - https://www.php.net/manual/en/book.xsl.php
"This extension requires the libxml PHP extension. This means passing the --with-libxml, or prior to PHP 7.4 the --enable-libxml, configuration flag, although this is implicitly accomplished because libxml is enabled by default. This extension uses libxslt which can be found at » http://xmlsoft.org/XSLT/. libxslt version 1.1.0 or greater is required."

常见问题:

Where are the plugin options?

In WordPress, go to Settings > XSLT Processor. There are four (4) sections :

  • Activate Content Types
  • Activate Shortcodes
  • Cache Lifetime
  • Local File Search Paths

Where is the documentation?

For a quick reference to the shortcodes and their main parameters, go to Settings > XSLT Processor. The samples for each shortcode show common usage. Full documentation and working examples are available at https://xsltproc.tenandtwo.com/. There are four (4) main sections :

更新日志:

1.0.x