{"id":184383,"date":"2024-03-06T00:38:07","date_gmt":"2024-03-06T00:38:07","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/tentwo-xslt-processor\/"},"modified":"2024-08-27T15:20:04","modified_gmt":"2024-08-27T15:20:04","slug":"tenandtwo-xslt-processor","status":"publish","type":"plugin","link":"https:\/\/es-do.wordpress.org\/plugins\/tenandtwo-xslt-processor\/","author":21093599,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.0.7","stable_tag":"1.0.7","tested":"6.5.8","requires":"5.2","requires_php":"7.4","requires_plugins":null,"header_name":"Ten&Two XSLT Processor","header_author":"Ten & Two Systems","header_description":"Transform and display XML from local and remote sources using PHP's XSL extension.","assets_banners_color":"","last_updated":"2024-08-27 15:20:04","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"https:\/\/wordpress.org\/plugins\/tenandtwo-xslt-processor\/","header_author_uri":"https:\/\/plugins.tenandtwo.com\/","rating":0,"author_block_rating":0,"active_installs":10,"downloads":1918,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":{"1.0.5":{"tag":"1.0.5","author":"tenandtwo","date":"2024-04-29 22:36:20"},"1.0.6":{"tag":"1.0.6","author":"tenandtwo","date":"2024-06-05 21:42:22"},"1.0.7":{"tag":"1.0.7","author":"tenandtwo","date":"2024-08-27 15:20:04"}},"upgrade_notice":[],"ratings":[],"assets_icons":[],"assets_banners":[],"assets_blueprints":{"blueprint.json":{"filename":"blueprint.json","revision":3142378,"resolution":false,"location":"assets","locale":"","contents":"{\"landingPage\":\"\\\/wp-admin\\\/plugins.php\",\"preferredVersions\":{\"php\":\"8.0\",\"wp\":\"latest\"},\"phpExtensionBundles\":[\"kitchen-sink\"],\"features\":{\"networking\":true},\"steps\":[{\"step\":\"installPlugin\",\"pluginZipFile\":{\"resource\":\"wordpress.org\\\/plugins\",\"slug\":\"tenandtwo-xslt-processor\"},\"options\":{\"activate\":true}},{\"step\":\"login\",\"username\":\"admin\",\"password\":\"password\"}]}"}},"all_blocks":[],"tagged_versions":["1.0.5","1.0.6","1.0.7"],"block_files":[],"assets_screenshots":{"screenshot-1.png":{"filename":"screenshot-1.png","revision":3046004,"resolution":"1","location":"assets","locale":""}},"screenshots":{"1":"XSLT Processor Settings"},"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[567,80,748,4992,4993],"plugin_category":[43],"plugin_contributors":[225119],"plugin_business_model":[],"class_list":["post-184383","plugin","type-plugin","status-publish","hentry","plugin_tags-csv","plugin_tags-shortcode","plugin_tags-xml","plugin_tags-xsl","plugin_tags-xslt","plugin_category-customization","plugin_contributors-tenandtwo","plugin_committers-tenandtwo"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/tenandtwo-xslt-processor.svg","icon_2x":false,"generated":true},"screenshots":[{"src":"https:\/\/ps.w.org\/tenandtwo-xslt-processor\/assets\/screenshot-1.png?rev=3046004","caption":"XSLT Processor Settings"}],"raw_content":"<!--section=description-->\n<p>The Ten&amp;Two XSLT Processor plugin brings the power of PHP's XSL extension to Wordpress.  Once enabled, the plugin creates three (3) shortcodes - <code>[xslt_transform_xml\/]<\/code>, <code>[xslt_select_xml\/]<\/code>, and <code>[xslt_select_csv\/]<\/code> - 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 - <code>XSL Stylesheets<\/code> and <code>XML Documents<\/code> - for managing and validating sources within WP Admin.<\/p>\n\n<p>Detailed documentation and sample code can be found at https:\/\/plugins.tenandtwo.com\/<\/p>\n\n<h3>Custom Post Types<\/h3>\n\n<p>The XSLT Processor plugin provides two (2) custom post types for managing sources within Wordpress - <code>XSL Stylesheets<\/code> and <code>XML Documents<\/code>.  Both types include basic syntax validation.  XML Documents can be validated further using DTD, XSD, or RNG.  Both types are enabled in Settings &gt; XSLT Processor Settings &gt; Activate Content Types.<\/p>\n\n<h3>Shortcode : [xslt_transform_xml\/]<\/h3>\n\n<pre><code>[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.\n<\/code><\/pre>\n\n<ul>\n<li><code>[xslt_transform_xml xsl=\"{file|url|id|slug}\" xml=\"{file|url|id|slug}\" \/]<\/code><\/li>\n<li><code>[xslt_transform_xml xsl=\"{file|url|id|slug}\"]&lt;DATA&gt;...&lt;\/DATA&gt;[\/xslt_transform_xml]<\/code><\/li>\n<\/ul>\n\n<p>If either the <code>xsl<\/code> or <code>xml<\/code> parameter is left unspecified, defaults are used.  The default XML value is <code>&lt;NODATA\/&gt;<\/code>.  The default XSL stylesheet prints all of the incoming data as HTML.  If extra attributes are specified in the shortcode - eg, <code>mykey=\"myval\"<\/code> - those keys\/values are passed along as parameters to the stylesheet - <code>&lt;xsl:param name=\"mykey\"\/&gt;<\/code>.<\/p>\n\n<h3>Shortcode : [xslt_select_xml\/]<\/h3>\n\n<pre><code>[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 :\n<\/code><\/pre>\n\n<ul>\n<li><code>[xslt_select_xml xml=\"{file|url|id|slug}\" select=\"{XPath}\" \/]<\/code><\/li>\n<li><code>[xslt_select_xml xml=\"{file|url|id|slug}\"]{XPath}[\/xslt_select_xml]<\/code><\/li>\n<\/ul>\n\n<p>If the XPath select parameter is left unspecified, the default <code>\/<\/code> is used, which returns the entire document.  The default output is <code>format=\"xml\"<\/code>.  If <code>format=\"json\"<\/code> is specified, the result is encoded as a JSON string.<\/p>\n\n<h3>Shortcode : [xslt_select_csv\/]<\/h3>\n\n<pre><code>[xslt_select_csv\/] is a helper function for converting CSV file data to XML.  The result can be output directly as an HTML `&lt;table&gt;`, or the result can be passed to `[xslt_transform_xml\/]` for further processing.\n<\/code><\/pre>\n\n<ul>\n<li><code>[xslt_select_csv csv=\"{file|url}\" \/]<\/code><\/li>\n<li><code>[xslt_select_csv]{csv,data}[\/xslt_select_csv]<\/code><\/li>\n<\/ul>\n\n<p>Three (3) parameters - <code>separator<\/code>, <code>enclosure<\/code>, <code>escape<\/code> - control reading the input.  See PHP's <code>fgetcsv()<\/code> function for details.<\/p>\n\n<ul>\n<li><code>[xslt_select_csv separator=\",\" enclosure=\"\\\"\" escape=\"\\\\\" \/]<\/code><\/li>\n<\/ul>\n\n<p>Two (2) parameters - <code>key_row<\/code>, <code>col<\/code> - control writing columns to the output.  The <code>key_row<\/code> attribute is optional, but allows labels from that row to be used in <code>col<\/code> and <code>key_col<\/code>.<\/p>\n\n<ul>\n<li><code>[xslt_select_csv key_row=\"{num}\" col=\"{num|letter|label}+\" \/]<\/code><\/li>\n<\/ul>\n\n<p>Three (3) parameters - <code>row<\/code>, <code>key_col<\/code>, <code>key<\/code> - control writing rows to the output.<\/p>\n\n<ul>\n<li><code>[xslt_select_csv row=\"{num}+\" \/]<\/code><\/li>\n<li><code>[xslt_select_csv key_col=\"{num|letter|label}\" key=\"{val}+\" \/]<\/code><\/li>\n<\/ul>\n\n<h3>Nested Shortcodes<\/h3>\n\n<p>Combine <code>[xslt_transform_xml]<\/code> with <code>[xslt_select_xml]<\/code> :<\/p>\n\n<ul>\n<li><code>[xslt_transform_xml][xslt_select_xml\/][\/xslt_transform_xml]<\/code><\/li>\n<\/ul>\n\n<p>Combine <code>[xslt_transform_xml]<\/code> with <code>[xslt_select_csv]<\/code> :<\/p>\n\n<ul>\n<li><code>[xslt_transform_xml][xslt_select_csv\/][\/xslt_transform_xml]<\/code><\/li>\n<\/ul>\n\n<p>Combine <code>[xslt_transform_xml]<\/code> with itself using <code>[\/xslt_transform_alias]<\/code> (WP does not support nested shortcodes with identical names) :<\/p>\n\n<ul>\n<li><code>[xslt_transform_alias][xslt_transform_xml\/][\/xslt_transform_alias]<\/code><\/li>\n<\/ul>\n\n<p>Combine multiple shortcodes\/sources to create a single <code>XML Document<\/code> (see Custom Post Types above) :<\/p>\n\n<ul>\n<li><code>&lt;DATA&gt;&lt;PART1&gt;[xslt_select_xml xml=\"f1.xml\" \/]&lt;\/PART1&gt;&lt;PART2&gt;[xslt_select_xml xml=\"f2.xml\" \/]&lt;\/PART2&gt;&lt;\/DATA&gt;<\/code><\/li>\n<\/ul>\n\n<h3>Cache Parameters<\/h3>\n\n<p>When a shortcode specifies a remote file - <code>xml=\"{url}\"<\/code> or <code>csv=\"{url}\"<\/code> - that source is cached locally using WP Transients. The default cache duration is set in the XSLT Processor Settings.  To override the default, add <code>cache=\"{minutes}\"<\/code> to the shortcode.<\/p>\n\n<ul>\n<li><code>[xslt_transform_xml xml=\"{url}\" cache=\"{minutes}\" \/]<\/code><\/li>\n<li><code>[xslt_select_xml xml=\"{url}\" cache=\"{minutes}\" \/]<\/code><\/li>\n<li><code>[xslt_select_csv csv=\"{url}\" cache=\"{minutes}\" \/]<\/code><\/li>\n<\/ul>\n\n<h3>Namespace Parameters<\/h3>\n\n<p>Within <code>[xslt_select_xml\/]<\/code> the plugin provides two (2) methods for handling XML containing namespaces.  The first is to add <code>strip-namespaces<\/code> to the shortcode.  The second method is to add the needed prefixes and namespace URIs using <code>xslns<\/code>.<\/p>\n\n<ul>\n<li><code>[xslt_select_xml xml=\"{file}\" strip-namespaces=\"yes\" select=\"\/\/node\" \/]<\/code><\/li>\n<li><code>[xslt_select_xml xml=\"{file}\" xmlns=\"ns1\" ns1=\"{namespace-uri-1}\" select=\"\/\/ns1:node\" \/]<\/code><\/li>\n<li><code>[xslt_select_xml xml=\"{file}\" xmlns=\"ns1 ns2\" ns1=\"{namespace-uri-1}\" ns2=\"{namespace-uri-2}\" select=\"\/\/ns1:node\/ns2:node\" \/]<\/code><\/li>\n<\/ul>\n\n<h3>WP-CLI<\/h3>\n\n<p>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.<\/p>\n\n<ul>\n<li><pre><code>wp xslt transform_xml\n    --xsl='{file|url|id|slug}'\n    --xml='{file|url|id|slug}'\n    --cache='{minutes, if xsl|xml={url}}'\n    --tidy='{yes|html}' or tidy or --tidy='xml'\n    --{myparam}='{myvalue}'\n    --outfile='{filepath}'\n    --htmlentities or --htmlentities='yes'\n<\/code><\/pre><\/li>\n<li><pre><code>wp xslt select_xml\n    --xml='{file|url|id|slug}'\n    --cache='{minutes, if xml={url}}'\n    --select='{xpath}'\n    --root='{nodename|empty}'\n    --tidy='{yes|html}' or tidy or --tidy='xml'\n    --strip-namespaces='yes' or strip-namespaces\n    --strip-declaration='no'\n    --format='{xml|json}'\n    --htmlentities or --htmlentities='yes'\n<\/code><\/pre><\/li>\n<li><pre><code>wp xslt select_csv\n    --csv='{file|url}'\n    --cache='{minutes, if csv={url}}'\n    --separator=','\n    --enclosure='\\\"'\n    --escape='\\\\'\n    --key_row='{row number for column labels}'\n    --col='{return column number(s), letter(s), or label(s)}'\n    --key_col='{col number, letter, or label for key matching}'\n    --key='{value(s) for key_col matching}'\n    --row='{return row number(s)}'\n    --class='{css classname(s) for result table}'\n    --htmlentities or --htmlentities='yes'\n<\/code><\/pre><\/li>\n<\/ul>\n\n<h3>XSL Stylesheets<\/h3>\n\n<p>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.<\/p>\n\n<ul>\n<li>date.xsl : <code>date-format<\/code>, <code>date-microtime<\/code><\/li>\n<li>file.xsl : <code>file-exists-local<\/code>, <code>file-exists-remote<\/code><\/li>\n<li>string.xsl : <code>string-replace<\/code>, <code>string-upper<\/code>, <code>string-lower<\/code>, <code>string-title-case<\/code>, <code>string-trim<\/code>, <code>string-rtrim<\/code>, <code>string-ltrim<\/code>, <code>string-maxlength<\/code>, <code>string-maxwords<\/code>, <code>string-add-slashes<\/code>, <code>string-urlencode<\/code>, <code>string-strip-tags<\/code>, <code>string-nl2br<\/code>, <code>string-entity-decode<\/code>, <code>string-to-nodeset<\/code><\/li>\n<li>util.xsl : <code>util-bytsize<\/code>, <code>util-hash-data<\/code>, <code>util-print-nodes<\/code>, <code>util-print-node-names<\/code>, <code>util-super-global<\/code><\/li>\n<li>wp.xsl : <code>wp-select-xml<\/code>, <code>wp-select-csv<\/code>, <code>wp-post-item<\/code>, <code>wp-post-meta<\/code>, <code>wp-sanitize-title<\/code>, <code>wp-size-format<\/code><\/li>\n<\/ul>\n\n<h3>Requirements<\/h3>\n\n<p>The Ten&amp;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 <code>LIBXSLT_VERSION<\/code> is undefined, all plugin options are disabled automatically and the second message is displayed.<\/p>\n\n<ul>\n<li><code>PHP's XSL extension is available : XSLT v1.1.32, EXSLT v1.1.32, LIBXML v2.9.4<\/code><\/li>\n<li><code>PHP's XSL extension is NOT available<\/code><\/li>\n<\/ul>\n\n<p>The XSL extension's requirements are detailed at php.net - https:\/\/www.php.net\/manual\/en\/book.xsl.php<\/p>\n\n<blockquote>\n  <p>\"This extension requires the libxml PHP extension. This means passing the --with-libxml,\n  or prior to PHP 7.4 the --enable-libxml, configuration flag, although this is implicitly\n  accomplished because libxml is enabled by default.<\/p>\n  \n  <p>This extension uses libxslt which can be found at \u00bb http:\/\/xmlsoft.org\/XSLT\/. libxslt\n  version 1.1.0 or greater is required.\"<\/p>\n<\/blockquote>\n\n<!--section=installation-->\n<h3>WordPress installation<\/h3>\n\n<ol>\n<li>Go to Plugins &gt; Add New &gt; Search for \"tenandtwo-xslt-processor\"<\/li>\n<li>Press \"Install Now\" for the \"Ten&amp;Two XSLT Processor\" plugin<\/li>\n<li>Press \"Activate Plugin\"<\/li>\n<\/ol>\n\n<h3>WP-CLI installation<\/h3>\n\n<ol>\n<li><code>wp plugin install tenandtwo-xslt-processor --activate<\/code><\/li>\n<\/ol>\n\n<h3>Manual installation<\/h3>\n\n<ol>\n<li>Download the latest archive from the Plugin Homepage : https:\/\/wordpress.org\/plugins\/tenandtwo-xslt-processor<\/li>\n<li>Upload the <code>tenandtwo-xslt-processor<\/code> directory to your <code>\/wp-content\/plugins\/<\/code> directory<\/li>\n<li>Activate the plugin through the \"Plugins\" menu in WordPress<\/li>\n<\/ol>\n\n<p>For more details on installation options, see Manage Plugins at wordpress.org - https:\/\/wordpress.org\/documentation\/article\/manage-plugins\/<\/p>\n\n<!--section=faq-->\n<dl>\n<dt id='where%20are%20the%20plugin%20options%3F'><h3>Where are the plugin options?<\/h3><\/dt>\n<dd><p>In WordPress, go to Settings &gt; XSLT Processor Settings.  There are four (4) sections :<\/p>\n\n<ul>\n<li>Activate Content Types<\/li>\n<li>Activate Shortcodes<\/li>\n<li>Cache Lifetime<\/li>\n<li>Local File Search Paths<\/li>\n<\/ul><\/dd>\n<dt id='where%20is%20the%20documentation%3F'><h3>Where is the documentation?<\/h3><\/dt>\n<dd><p>For a quick reference to the shortcodes and their main parameters, go to Settings &gt; XSLT Processor Settings.  The samples for each shortcode show common usage.<\/p>\n\n<p>Full documentation and working examples are available at https:\/\/plugins.tenandtwo.com\/.  There are four (4) main sections :<\/p>\n\n<ul>\n<li>Getting Started : https:\/\/plugins.tenandtwo.com\/xslt-processor\/getting-started<\/li>\n<li>Shortcodes      : https:\/\/plugins.tenandtwo.com\/xslt-processor\/shortcodes<\/li>\n<li>Stylesheets     : https:\/\/plugins.tenandtwo.com\/xslt-processor\/stylsheets<\/li>\n<li>How To          : https:\/\/plugins.tenandtwo.com\/xslt-processor\/how-to<\/li>\n<\/ul><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.0.x<\/h4>\n\n<ul>\n<li>Initial Release<\/li>\n<li>Add WP-CLI commands<\/li>\n<li>Test with WP 6.5<\/li>\n<\/ul>","raw_excerpt":"Transform and display XML from local and remote sources using PHP&#039;s XSL extension.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/es-do.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/184383","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/es-do.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/es-do.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/es-do.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=184383"}],"author":[{"embeddable":true,"href":"https:\/\/es-do.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/tenandtwo"}],"wp:attachment":[{"href":"https:\/\/es-do.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=184383"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/es-do.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=184383"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/es-do.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=184383"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/es-do.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=184383"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/es-do.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=184383"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/es-do.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=184383"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}