Search Results

Search found 44 results on 2 pages for 'xsltprocessor'.

Page 1/2 | 1 2  | Next Page >

  • How to find problem with PHP XSLTProcessor when return from transformToXML is false and libxml_get_

    - by John
    I'm working on the code below to allow HTTP user agents that cannot perform XSL transformations to view the resources on my server. I'm mystified because the result of transformToXML is false, but the result of libxml_get_errors() is an empty array. As you can see, the code outputs the LibXSLT version ID and I'm getting the problem on WinVista with version 1.1.24. Is libxml_get_errors() not the right function to get the errors from the XSLTProcessor object? If you're interested in the XML documents, you can get them from http://bobberinteractive.com/index.xhtml and .../stylesheets/layout.xsl <?php //redirect browsers that can handle the source files. if (strpos ( $_SERVER ['HTTP_ACCEPT'], 'application/xhtml+xml' )) { header ( "HTTP/1.1 301 Moved Permanently" ); header ( "Location: http://" . $_SERVER ['SERVER_NAME'] . "/index.xhtml" ); header ( "Content-Type: text/text" ); echo "\nYour browser is capable of processing the <a href='/index.xhtml' site contents on its own."; die (); } //start by checking the template $baseDir = dirname ( __FILE__ ); $xslDoc = new DOMDocument (); if (! $xslDoc-load ( $baseDir . '/stylesheets/layout.xsl' )) { header ( "HTTP/1.1 500 Server Error" ); header ( "Content-Type: text/plain" ); echo "\n Can't load " . $baseDir . '/stylesheets/layout.xsl'; die (); } //resolve the requested resource (browsers that need transformation will request the resource without the suffix) $uri = $_SERVER ['REQUEST_URI']; $len = strlen ( $uri ); if (1 = $len || '/' == substr ( $uri, $len - 1 )) { $fileName = $baseDir . "/index.xhtml"; // use 'default' document if pathname ends in '/' } else { $fileName = $baseDir . (1 load ( $fileName )) { header ( "HTTP/1.1 500 Server Error" ); echo "\n Can't load " . $fileName; die (); } // now start the XSL template processing $proc = new XSLTProcessor (); $proc-importStylesheet ( $xslDoc ); $doc = $proc-transformToXML ( $xmlDoc ); if (false === $doc) { header ( "HTTP/1.1 500 Server Error" ); header ( "Content-Type: text/plain" ); echo "\n"; // HERE is where it gets strange: the value of $doc is false and libxml_get_errors returns 0 entries. display_xml_errors ( libxml_get_errors() ); die (); } header ( "Content-Type: text/html" ); echo "\n"; echo $doc; function display_xml_errors($errors) { echo count ( $errors ) . " Error(s) from LibXSLT " . LIBXSLT_DOTTED_VERSION; for($i = 0; $i level) { case LIBXML_ERR_WARNING : $return .= "Warning $error-code: "; break; case LIBXML_ERR_ERROR : $return .= "Error $error-code: "; break; case LIBXML_ERR_FATAL : $return .= "Fatal Error $error-code: "; break; } $return .= trim ( $error-message ) . "\n Line: $error-line" . "\n Column: $error-column"; if ($error-file) { $return .= "\n File: $error-file"; } echo "$return\n\n--------------------------------------------\n\n"; } }

    Read the article

  • PHP and XSLTProcessor Misbehavior

    - by Aiden Bell
    Hi all, Simple question: Why is a PHP function called from an XSL Stylesheet just returning the last argument passed: foo.xsl: <xsl:template match="/"> <xsl:value-of select="php:function('date','c')" /> </xsl:template> PHP: ... $xsl = new XSLTProcessor(); $xsl->registerPHPFunctions(); $xsl->importStylesheet($fooStylesheet); echo $xsl->transformToXML($myXML); I Get the output c and if I call <xsl:value-of select="php:function('date')" /> I just get date as my output. Seems strange to me. Version info: PHP 5.3.2 libxslt Version 1.1.26 libxslt compiled against libxml Version 2.7.6 EXSLT enabled libexslt Version 1.1.26

    Read the article

  • How to create a HTML5 + SVG document using the PHP XSLTProcessor

    - by Kau-Boy
    For a little project about XML I try to use HTML5 as it has SVG and WAI-ARIA Support. I also want to use a XSL stylesheet for my document. But I can't get a valid HTML5 document with a nested SVG. Here are some version I tested so far: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output indent="yes" method="xml"/> <xsl:template match="/"> <html xmlns="http://www.w3.org/1999/xhtml"> // content with the svg tag in the body </html> </xsl:template> </xsl:stylesheet> In combination with header('Content-Type: application/xml'); it works and produces this HTML output: <?xml version="1.0"?> <html xmlns="http://www.w3.org/1999/xhtml"> // content with the svg tag in the body </html> But it is not HTML5 and without a DOCTYPE I get a lot of errors on the W3 validator. So trying to get a HTML5 document I used the following XSL: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output indent="yes" method="html"/> <xsl:template match="/"> <xsl:text disable-output-escaping='yes'>&lt;!DOCTYPE HTML></xsl:text> <html> // content with the svg tag in the body </html> </xsl:template> </xsl:stylesheet> But unfortunately that will produce thze following HTML output: <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> .... </head> // content with the svg tag in the body </html> As you can see it's regular HTML5 but using it in combination with header('Content-Type: application/xml'); it fails because of the missing slash at the end of the meta tag (which was automatically created). Using header('Content-Type: image/xhtml+svg'); or header('Content-Type: text/html'); there is no XML parsing error, but the page will not show the SVG as a graph but as text (without the tags). Can anyone tell me how to avoid the meta tag to be inserted or how to set a propper Content-Type that will make the browser rendern the SVG. Or even any other hint to get this working. I would really like to keep HTML5 to be able to keep the WAI-ARIA Landmark Roles an the HTML5 tags like NAV and FOOTER.

    Read the article

  • Issue with XSLT Processing on PHP

    - by monksy
    I'm getting a few errors from XSLTProcessor: XSLTProcessor::transformToDoc() [<a href='function.XSLTProcessor-transformToDoc'>function.XSLTProcessor-transformToDoc</a>]: Invalid or inclomplete context XSLTProcessor::transformToDoc() [<a href='function.XSLTProcessor-transformToDoc'>function.XSLTProcessor-transformToDoc</a>]: XSLTProcessor::transformToDoc() [<a href='function.XSLTProcessor-transformToDoc'>function.XSLTProcessor-transformToDoc</a>]: xsltValueOf: text copy failed in Which is parsing this XSLT Line: <xsl:apply-templates select="page/sections/section" mode="subset"/> The section is: <xsl:template match="page/sections/section" mode="subset"> <a href="#{shorttitle}"> <xsl:value-of select="title"/> </a> <xsl:if test="position() != last()"> | </xsl:if> </xsl:template> The XML that the section is parsing is: <shorttitle>About</shorttitle> <title>#~ About</title> The PHP XSLT Code is: $xslt = new XSLTProcessor(); $XSL = new DOMDocument(); $XSL->load( $xsltFile, LIBXML_NOCDATA); $xslt->importStylesheet( $XSL ); print $xslt->transformToXML( $XML ); My suspicion about the the errors is due to content. I'm not getting these errors with Firefox's XSLT rendering, nor am I getting an invalid XML document on the backend.I'm not getting errors on the load, its just on the transformToXML function. Does anyone have a clue on how to solve this? This is with PHP5.

    Read the article

  • Xsl mime type problem

    - by savruk
    Hi, I have a busybox with lighttpd running on as http server. My problem is while firefox and opera can get the page with applied xsl, Arora(webkit) can not. Here is the script I use to get it work: <html> <head> <script> function loadXMLDoc(dname) { if (window.XMLHttpRequest) { xhttp=new XMLHttpRequest(); } else { xhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xhttp.open("GET",dname,false); xhttp.send(""); return xhttp.responseXML; } function querySt(ji) { hu = window.location.search.substring(1); gy = hu.split("&"); for (i=0;i<gy.length;i++) { ft = gy[i].split("="); if (ft[0] == ji) { return ft[1]; } } } function displayResult() { xml=loadXMLDoc("sample.xml"); alert(xml)//Gives [object Document] $scan=querySt("scan"); $sub = querySt("sub"); xsl=loadXMLDoc("sample.xsl"); alert(xsl)//Gives Null // code for IE if (window.ActiveXObject) { ex=xml.transformNode(xsl); document.getElementById("example").innerHTML=ex; } // code for Mozilla, Firefox, Opera, etc. else if (document.implementation && document.implementation.createDocument) { xsltProcessor=new XSLTProcessor(); xsltProcessor.importStylesheet(xsl); xsltProcessor.setParameter(null,"scan",$scan) if($sub != ""){ xsltProcessor.setParameter(null,"sub",$sub) } resultDocument = xsltProcessor.transformToFragment(xml,document); document.getElementById("example").appendChild(resultDocument); } } </script> </head> <body onload="displayResult()"> <div id="example" ></div> </body> </html> I tried to see if it load xsl well and put an alert(xsl) but it gives null. Other browser can get xml and xsl files perfectly. What can be the problem? Thanks P.S: It runs well on my local server with all browser.

    Read the article

  • JQuery > XSLT Plugin > Component returned failure code: 0x80600011 [nsIXSLTProcessorObsolete.transfo

    - by Sean Ochoa
    So, I'm using the XSLT plugin for JQuery, and here's my code: function AddPlotcardEventHandlers(){ // some code } function reportError(exception){ alert(exception.constructor.name + " Exception: " + ((exception.name) ? exception.name : "[unknown name]") + " - " + exception.message); } function GetPlotcards(){ $("#content").xslt("../xml/plotcards.xml","../xslt/plotcards.xsl", AddPlotcardEventHandlers,reportError); } Here's the modified jquery plugin. I say that its modified because I've added callbacks for success and error handling. /* * jquery.xslt.js * * Copyright (c) 2005-2008 Johann Burkard (<mailto:[email protected]>) * <http://eaio.com> * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. * */ /** * jQuery client-side XSLT plugins. * * @author <a href="mailto:[email protected]">Johann Burkard</a> * @version $Id: jquery.xslt.js,v 1.10 2008/08/29 21:34:24 Johann Exp $ */ (function($) { $.fn.xslt = function() { return this; } var str = /^\s*</; if (document.recalc) { // IE 5+ $.fn.xslt = function(xml, xslt, onSuccess, onError) { try{ var target = $(this); var change = function() { try{ var c = 'complete'; if (xm.readyState == c && xs.readyState == c) { window.setTimeout(function() { target.html(xm.transformNode(xs.XMLDocument)); if (onSuccess) onSuccess(); }, 50); } }catch(exception){ if (onError) onError(exception); } }; var xm = document.createElement('xml'); xm.onreadystatechange = change; xm[str.test(xml) ? "innerHTML" : "src"] = xml; var xs = document.createElement('xml'); xs.onreadystatechange = change; xs[str.test(xslt) ? "innerHTML" : "src"] = xslt; $('body').append(xm).append(xs); return this; }catch(exception){ if (onError) onError(exception); } }; } else if (window.DOMParser != undefined && window.XMLHttpRequest != undefined && window.XSLTProcessor != undefined) { // Mozilla 0.9.4+, Opera 9+ var processor = new XSLTProcessor(); var support = false; if ($.isFunction(processor.transformDocument)) { support = window.XMLSerializer != undefined; } else { support = true; } if (support) { $.fn.xslt = function(xml, xslt, onSuccess, onError) { try{ var target = $(this); var transformed = false; var xm = { readyState: 4 }; var xs = { readyState: 4 }; var change = function() { try{ if (xm.readyState == 4 && xs.readyState == 4 && !transformed) { var processor = new XSLTProcessor(); if ($.isFunction(processor.transformDocument)) { // obsolete Mozilla interface resultDoc = document.implementation.createDocument("", "", null); processor.transformDocument(xm.responseXML, xs.responseXML, resultDoc, null); target.html(new XMLSerializer().serializeToString(resultDoc)); } else { processor.importStylesheet(xs.responseXML); resultDoc = processor.transformToFragment(xm.responseXML, document); target.empty().append(resultDoc); } transformed = true; if (onSuccess) onSuccess(); } }catch(exception){ if (onError) onError(exception); } }; if (str.test(xml)) { xm.responseXML = new DOMParser().parseFromString(xml, "text/xml"); } else { xm = $.ajax({ dataType: "xml", url: xml}); xm.onreadystatechange = change; } if (str.test(xslt)) { xs.responseXML = new DOMParser().parseFromString(xslt, "text/xml"); change(); } else { xs = $.ajax({ dataType: "xml", url: xslt}); xs.onreadystatechange = change; } }catch(exception){ if (onError) onError(exception); }finally{ return this; } }; } } })(jQuery); And, here's my error msg: Object Exception: [unknown name] - Component returned failure code: 0x80600011 [nsIXSLTProcessorObsolete.transformDocument] Here's the info on the browser that I'm using for testing (with firebug v1.5.4 add-on installed): Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 I'm really not sure what to do about this.... any thoughts?

    Read the article

  • Component returned failure code: 0x80600011 [nsIXSLTProcessorObsolete.transformDocument]

    - by Sean Ochoa
    So, I'm using the XSLT plugin for JQuery, and here's my code: function AddPlotcardEventHandlers(){ // some code } function reportError(exception){ alert(exception.constructor.name + " Exception: " + ((exception.name) ? exception.name : "[unknown name]") + " - " + exception.message); } function GetPlotcards(){ $("#content").xslt("../xml/plotcards.xml","../xslt/plotcards.xsl", AddPlotcardEventHandlers,reportError); } Here's the modified jquery plugin. I say that its modified because I've added callbacks for success and error handling. /* * jquery.xslt.js * * Copyright (c) 2005-2008 Johann Burkard (<mailto:[email protected]>) * <http://eaio.com> * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. * */ /** * jQuery client-side XSLT plugins. * * @author <a href="mailto:[email protected]">Johann Burkard</a> * @version $Id: jquery.xslt.js,v 1.10 2008/08/29 21:34:24 Johann Exp $ */ (function($) { $.fn.xslt = function() { return this; } var str = /^\s*</; if (document.recalc) { // IE 5+ $.fn.xslt = function(xml, xslt, onSuccess, onError) { try{ var target = $(this); var change = function() { try{ var c = 'complete'; if (xm.readyState == c && xs.readyState == c) { window.setTimeout(function() { target.html(xm.transformNode(xs.XMLDocument)); if (onSuccess) onSuccess(); }, 50); } }catch(exception){ if (onError) onError(exception); } }; var xm = document.createElement('xml'); xm.onreadystatechange = change; xm[str.test(xml) ? "innerHTML" : "src"] = xml; var xs = document.createElement('xml'); xs.onreadystatechange = change; xs[str.test(xslt) ? "innerHTML" : "src"] = xslt; $('body').append(xm).append(xs); return this; }catch(exception){ if (onError) onError(exception); } }; } else if (window.DOMParser != undefined && window.XMLHttpRequest != undefined && window.XSLTProcessor != undefined) { // Mozilla 0.9.4+, Opera 9+ var processor = new XSLTProcessor(); var support = false; if ($.isFunction(processor.transformDocument)) { support = window.XMLSerializer != undefined; } else { support = true; } if (support) { $.fn.xslt = function(xml, xslt, onSuccess, onError) { try{ var target = $(this); var transformed = false; var xm = { readyState: 4 }; var xs = { readyState: 4 }; var change = function() { try{ if (xm.readyState == 4 && xs.readyState == 4 && !transformed) { var processor = new XSLTProcessor(); if ($.isFunction(processor.transformDocument)) { // obsolete Mozilla interface resultDoc = document.implementation.createDocument("", "", null); processor.transformDocument(xm.responseXML, xs.responseXML, resultDoc, null); target.html(new XMLSerializer().serializeToString(resultDoc)); } else { processor.importStylesheet(xs.responseXML); resultDoc = processor.transformToFragment(xm.responseXML, document); target.empty().append(resultDoc); } transformed = true; if (onSuccess) onSuccess(); } }catch(exception){ if (onError) onError(exception); } }; if (str.test(xml)) { xm.responseXML = new DOMParser().parseFromString(xml, "text/xml"); } else { xm = $.ajax({ dataType: "xml", url: xml}); xm.onreadystatechange = change; } if (str.test(xslt)) { xs.responseXML = new DOMParser().parseFromString(xslt, "text/xml"); change(); } else { xs = $.ajax({ dataType: "xml", url: xslt}); xs.onreadystatechange = change; } }catch(exception){ if (onError) onError(exception); }finally{ return this; } }; } } })(jQuery); And, here's my error msg: Object Exception: [unknown name] - Component returned failure code: 0x80600011 [nsIXSLTProcessorObsolete.transformDocument] Here's the info on the browser that I'm using for testing (with firebug v1.5.4 add-on installed): Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 Here's my XML: <?xml version="1.0" encoding="ISO-8859-1"?> <plotcardCollection sortby="order"> <plotcard order="2" id="1378"> <name><![CDATA[[placeholder for name of plotcard 1378]]]></name> <content><![CDATA[[placeholder for content of plotcard 1378]]]></content> <tagCollection> <tag id="3"><![CDATA[[placeholder for tag with id=3]]]></tag> <tag id="7"><![CDATA[[placeholder for tag with id=7]]]></tag> </tagCollection> </plotcard> <plotcard order="1" id="2156"> <name><![CDATA[[placeholder for name of plotcard 2156]]]></name> <content><![CDATA[[placeholder for content of plotcard 2156]]]></content> <tagCollection> <tag id="2"><![CDATA[[placeholder for tag with id=2]]]></tag> <tag id="9"><![CDATA[[placeholder for tag with id=9]]]></tag> </tagCollection> </plotcard> </plotcardCollection> Here's my XSLT: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/plotcardCollection"> <xsl:variable name="sortby" select="@sortby" /> <xsl:for-each select="plotcard"> <xsl:sort select="$sortby" data-type="number" order="ascending"/> <div> <!-- Start Plotcard --> <xsl:attribute name="class">Plotcard</xsl:attribute> <xsl:for-each select="@"> <xsl:value-of select="name()"/> <xsl:text>='</xsl:text> <xsl:if test="name() = 'id'"> <xsl:text>Plotcard-</xsl:text> </xsl:if> <xsl:value-of select="." /> <xsl:text>'</xsl:text> </xsl:for-each> <!-- Start Plotcard Name Section --> <div> <xsl:attribute name="class"> <xsl:text disable-output-escaping="yes">PlotcardName</xsl:text> </xsl:attribute> <xsl:value-of select="name/text()"/> </div> <!-- Start Plotcard Content Section --> <div> <xsl:attribute name="class"> <xsl:text disable-output-escaping="yes">PlotcardContent</xsl:text> </xsl:attribute> <xsl:value-of select="content/text()"/> </div> </div> </xsl:for-each> </xsl:template> </xsl:stylesheet> I'm really not sure what to do about this.... any thoughts?

    Read the article

  • [PHP] Processing custom XML namespace within XSL

    - by sander
    I'm using the php class XSLTProcessor to generate HTML from a xsl. Within the xsl, I'd like all my custom namespace elements to be processed by my own processor class. So for example: <xsl:for-each select="doc/elements/*"> <doc:renderElement element="." /> </xsl:for-each> This should call the method renderElement of an instance of my custom processor class. I know I can enable calling php functions by using the registerPHPFunctions function. However, this only seems to support calling static methods.

    Read the article

  • encodingStyle usage in XmlSerializer.Serialize

    - by Vishal Seth
    Can somebody please explain the use of 4th parameter of public void Serialize( XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, string encodingStyle ) My issue is this: I've following string in one of the fields of my object: "reviewed ?" // music notation When I serialize it, it becomes & # x E; // see it as one word, w/o spaces it won't let me type And it fails when I try to transform this .NET generated XML through another XSL file Is it happening because its serializing using UTF-16? Is there any way I can make it transform using UTF-8 and make this "error" go away? **

    Read the article

  • How do i modify the XSL to change the xml format.

    - by user323719
    In the below XSL. <xsl:param name="insert-file" as="document-node()" /> <xsl:template match="*"> <xsl:variable name="input">My text</xsl:variable> <xsl:variable name="Myxml" as="element()*"> <xsl:call-template name="populateTag"> <xsl:with-param name="nodeValue" select="$input"/> </xsl:call-template> </xsl:variable> <xsl:copy-of select="$Myxml"></xsl:copy-of> </xsl:template> <xsl:template name="populateTag"> <xsl:param name="nodeValue"/> <xsl:for-each select="$insert-file/insert-data/data"> <xsl:choose> <xsl:when test="@index = 1"> <a><xsl:value-of select="$nodeValue"></xsl:value-of></a> </xsl:when> </xsl:choose> </xsl:for-each> </xsl:template> I am getting the output as: <?xml version="1.0" encoding="UTF-8"? <aMy text</a <aMy text</a <aMy text</a <aMy text</a I want template "populateTag" to retun me the xml in the below format. How do i modify the template "populateTag" to achive the same. Expected output from template "populateTag": <?xml version="1.0" encoding="UTF-8"? <a<a<a<aMy text</a</a</a</a Please give your ideas.

    Read the article

  • Why is xslt converter ignoring the content of <link>-tag

    - by Kristoffer Nolgren
    When I put forexample this in my xslt-stylesheet: <link><xsl:text>test</xsl:text></link> Or this: <link>test</link> I get the following result: <link xmlns=""></link> This however: <linkb>test</linkb> Render the following result: <linkb xmlns="">test</linkb> The rest of the xslt does not seem to make any difference, i've tried it in several different and empty xslt-stylesheets This problem appears in backend conversion (php) aswell as frontend-konversion in chrome browser (but not in Firefox) Example of error: dev.resihop.nu (right above the footer)

    Read the article

  • Improving the performance of XSL

    - by Rachel
    In the below XSL for the variable "insert-data", I have an input param with the structure, <insert-data> <data compareIndex="4" nodeName="d1e1"> <a/> </data> <data compareIndex="5" nodeName="d1e1"> <b/> </data> <data compareIndex="7" nodeName="d1e2"> <a/> </data> <data compareIndex="9" nodeName="d1e2"> <b/> </data> </insert-data> where "nodeName" is the id of a node and "compareIndex" is the position of the text content relative to the node having id "$nodeName". I am using the below XSL to select all the text nodes(generate-id) that satisfy the above condition and construct a data xml. The below implementation works perfectly but the time taken for the execution is in min. Is there a better way of implementing or is there any in-efficient operation being used. From my observation the code where the preceding text length is calculated consumes the major time. Please share your thoughts to improve the performance of the XSL. I am using Java SAXON XSL transformer. <xsl:variable name="insert-data" as="element()*"> <xsl:for-each select="$insert-file/insert-data/data"> <xsl:sort select="xsd:integer(@index)"/> <xsl:variable name="compareIndex" select="xsd:integer(@compareIndex)" /> <xsl:variable name="nodeName" select="@nodeName" /> <xsl:variable name="nodeContent" as="node()"> <xsl:copy-of select="node()"/> </xsl:variable> <xsl:for-each select="$main-root/*//text()[ancestor::*[@id = $nodeName]]"> <xsl:variable name="preTextLength" as="xsd:integer" select="sum((preceding::text())[. ancestor::*[@id = $nodeName]]/string-length(.))" /> <xsl:variable name="currentTextLength" as="xsd:integer" select="string-length(.)" /> <xsl:variable name="sum" select="$preTextLength + $currentTextLength" as="xsd:integer"></xsl:variable> <xsl:variable name="split-index" select="$compareIndex - $preTextLength" as="xsd:integer"></xsl:variable> <xsl:if test="($sum ge $compareIndex) and ($compareIndex gt $preTextLength)"> <data split-index="{$split-index}" text-id="{generate-id(.)}"> <xsl:copy-of select="$nodeContent"/> </data> </xsl:if> </xsl:for-each> </xsl:for-each> </xsl:variable>

    Read the article

  • Merge functionality of two xsl files into a single file (not a xsl import or include issue)

    - by anuamb
    I have two xsl files; both of them perform different tasks on source xml one after another. Now I need a single xsl file which will actually perform both these tasks in single file (its not an issue of xsl import or xsl include): say my source xml is: <LIST_R7P1_1 <R7P1_1 <LVL2 <ORIG_EXP_PRE_CONV#+# <EXP_AFT_CONVabc <GUARANTEE_AMOUNT#+# <CREDIT_DER/ </LVL2 <LVL21 <AZ#+# <BZbz1 <AZaz2 <BZ#+# <CZ/ </LVL21 </R7P1_1 </LIST_R7P1_1 My first xsl (tr1.xsl) removes all nodes whose value is blank or null: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="@*|node()"> <xsl:if test=". != '' or ./@* != ''"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:if> <xsl:template </xsl:stylesheet The output here is <LIST_R7P1_1 <R7P1_1 <LVL2 <ORIG_EXP_PRE_CONV#+# <EXP_AFT_CONVabc <GUARANTEE_AMOUNT#+# </LVL2 <LVL21 <AZ#+# <BZbz1 <AZaz2 <BZ#+# </LVL21 </R7P1_1 </LIST_R7P1_1 And my second xsl (tr2.xsl) does a global replace (of #+# with text blank'') on the output of first xsl: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" <xsl:template name="globalReplace" <xsl:param name="outputString"/ <xsl:param name="target"/ <xsl:param name="replacement"/ <xsl:choose <xsl:when test="contains($outputString,$target)"> <xsl:value-of select= "concat(substring-before($outputString,$target), $replacement)"/> <xsl:call-template name="globalReplace"> <xsl:with-param name="outputString" select="substring-after($outputString,$target)"/> <xsl:with-param name="target" select="$target"/> <xsl:with-param name="replacement" select="$replacement"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$outputString"/> </xsl:otherwise> </xsl:choose </xsl:template <xsl:template match="text()" <xsl:template match="@*|*"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet So my final output is <LIST_R7P1_1 <R7P1_1 <LVL2 <ORIG_EXP_PRE_CONV <EXP_AFT_CONVabc <GUARANTEE_AMOUNT </LVL2 <LVL21 <AZ <BZbz1 <AZaz2 <BZ </LVL21 </R7P1_1 </LIST_R7P1_1 My concern is that instead of these two xsl (tr1.xsl and tr2.xsl) I only need a single xsl (tr.xsl) which gives me final output? Say when I combine these two as <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" <xsl:template match="@*|node()" <xsl:if test=". != '' or ./@* != ''"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:if> <xsl:template name="globalReplace" <xsl:param name="outputString"/ <xsl:param name="target"/ <xsl:param name="replacement"/ <xsl:choose <xsl:when test="contains($outputString,$target)"> <xsl:value-of select= "concat(substring-before($outputString,$target), $replacement)"/> <xsl:call-template name="globalReplace"> <xsl:with-param name="outputString" select="substring-after($outputString,$target)"/> <xsl:with-param name="target" select="$target"/> <xsl:with-param name="replacement" select="$replacement"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$outputString"/> </xsl:otherwise> </xsl:choose </xsl:template <xsl:template match="text()" <xsl:call-template name="globalReplace" <xsl:with-param name="outputString" select="."/ <xsl:with-param name="target" select="'#+#'"/ <xsl:with-param name="replacement" select="''"/ </xsl:call-template </xsl:template <xsl:template match="@|" <xsl:copy <xsl:apply-templates select="@*|node()"/ </xsl:copy </xsl:template </xsl:stylesheet it outputs: <LIST_R7P1_1 <R7P1_1 <LVL2 <ORIG_EXP_PRE_CONV <EXP_AFT_CONVabc <GUARANTEE_AMOUNT <CREDIT_DER/ </LVL2 <LVL21 <AZ <BZbz1 <AZaz2 <BZ <CZ/ </LVL21 </R7P1_1 </LIST_R7P1_1 Only replacement is performed but not null/blank node removal.

    Read the article

  • How to get position of parent element - XSL

    - by joe
    What I wish I could do in xsl is the following, but unfortunatly parent/position() is not valid. XSL <xsl:template match="li"> <bullet> <xsl:apply-templates/> </bullet> <!-- todo: if this is the last bullet AND there are no more "p" tags, output footer --> <xsl:if test="count(ancestor::div/*) = parent/position()"> <footer/> </xsl:if> </xsl:template> XML <html> <div> <p>There is an x number of me</p> <p>There is an x number of me</p> <p>There is an x number of me</p> <ul> <li>list item</li> <li>list item</li> <li>list item</li> <li>list item</li> <li>list item</li> </ul> </div> </html> Anyone have any ideas how to figure out this problem from WITHIN my template match for li? Thanks!

    Read the article

  • Issue with XSL Criteria

    - by Rachel
    I am using the below piece of XSL to select the id of the text nodes whose content has a given index. This index value in input will be relative to a spcified node whose id value is known. The criteria to select the text node is, The text node content should contain a index say 'i' relative to node say 'n' whose id value i know. 'i' and 'id of n' is got as index and nodeName from the input param as seen in the xsl. Node 'd1e5' has the text content whose index ranges from 1 to 33. When i give an index value greater than 33 i want the below criteria to fail but it does not, [sum((preceding::text(), .)[normalize-space()][. >> //*[@id=$nodeName]]/string-length(.)) ge $index] Input xml: <?xml version="1.0" encoding="UTF-8"?> <html xmlns="http://www.w3.org/1999/xhtml" id="d1e1"> <head id="d1e3"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title id="d1e5">Every document must have a title</title> </head> <body id="d1e9"> <h1 id="d1e11" align="center">Very Important Heading</h1> <p id="d1e13">Since this is just a sample, I won't put much text here.</p> </body> </html> XSL code used: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsd="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xsd" version="2.0"> <xsl:param name="insert-file" as="node()+"> <insert-data><data index="1" nodeName="d1e5"></data><data index="34" nodeName="d1e5"></data></insert-data> </xsl:param> <xsl:param name="nodeName" as="xsd:string" /> <xsl:variable name="main-root" as="document-node()" select="/"/> <xsl:variable name="insert-data" as="element(data)*"> <xsl:for-each select="$insert-file/insert-data/data"> <xsl:sort select="xsd:integer(@index)"/> <xsl:variable name="index" select="xsd:integer(@index)" /> <xsl:variable name="nodeName" select="@nodeName" /> <data text-id="{generate-id($main-root/descendant::text()[sum((preceding::text(), .)[normalize-space()][. >> //*[@id=$nodeName]]/string-length(.)) ge $index][1])}"> </data> </xsl:for-each> </xsl:variable> <xsl:template match="/"> <Output> <xsl:copy-of select="$insert-data" /> </Output> </xsl:template> </xsl:stylesheet> Actual output: <?xml version="1.0" encoding="UTF-8"?> <Output> <data text-id="d1t8"/> <data text-id="d1t14"/> </Output> Expected output: <?xml version="1.0" encoding="UTF-8"?> <Output> <data text-id="d1t8"/> </Output> This solution works fine if index lies between 1 and 33. Any index value greater that 33 causes incorrect text nodes to get selected. I could not understand why the text node 'd1t14' is getting selected. Please share your thoughts.

    Read the article

  • Adding <span> tags to all text nodes between custom self closing tags.

    - by Rachel
    I have a pair of custom self closing tags s1 and s2 defined in namespace x in my xhtml. For each tag pair s1, s2 having the same id, I want to add span tags to all the text nodes between them. Each s1, s2 tag pair have a unique id. The s1 tag has an attribute 'styleName' which needs to be copied as the class name for the span tags populated for the s1,s2 pair. Within a s1, s2 tag pair, other s1, s2 tags can occur. It is the id attribute of the tags s1 and s2 that help us to find the postion from where we need to start populating the span(for text nodes alone) and the end where we need to stop. In case of common text nodes that is part of the multiple s1, s2 pairs then the span tags needs to be opened and closed appropirately as shown in the sample below. I am not specific with the format of the id populated for the span tag. Along as it is unique it is fine. Can we achive this kind of a solution using XSL. I am using Saxon processor. Sample input: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:x="http://sample.org"> <head> <title>This is my title</title> </head> <body> <h1 align="center">This <x:s1 id="1" styleName="name_1"/>is my <x:s2 id="1" />heading</h1> <p> Sample content <x:s1 id="2" styleName="name_2"/> Some text here. </p> <p> Here you <x:s2 id="2" />go. </p> <p> <x:s1 id="3" styleName="name_3"/>This <x:s1 id="4" styleName="name_4"/>is just a simple text <x:s2 id="4" />Some text here.<x:s2 id="3" /> Some content here. </p> <p> Use this <x:s1 id="5" styleName="name_5"/>space. </p> <p> Indroducing <x:s1 id="6" styleName="name_6"/> more information. </p> <p> Can add some <x:s2 id="6" />more content here. </p> <p> Sample content <x:s2 id="5" />Some text here. Some content here. </p> <p> <x:s1 id="7" styleName="name_7"/>This is a complex data. <x:s1 id="8" styleName="name_8"/>Framing a long sentence to <x:s2 id="7" />accomodate all possible <x:s2 id="8" />scenarios. </p> <p> <x:s1 id="9" styleName="name_9"/>More data can be <x:s1 id="10" styleName="name_10"/>added here. </p> <p> Trying to include here. </p> <p> Modifying <x:s2 id="9" />content <x:s2 id="10" />here. </p> </body> </html> Sample output: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:x="http://sample.org"> <head> <title>This is my title</title> </head> <body> <h1 align="center">This <span id="1_1" class="name_1">is my </span>heading</h1> <p> Sample content <span id="2_1" class="name_2"> Some text here.</span> </p> <p> <span id="2_2" class="name_2">Here you </span>go. </p> <p> <span id="3_1" class="name_3">This <span id="4_1" class="name_4">is just a simple text </span>Some text here.</span> Some content here. </p> <p> Use this <span id="5_1" class="name_5">space.</span> </p> <p> <span id="5_2" class="name_5">Indroducing <span id="6_1" class="name_6"> more information.</span></span> </p> <p> <span id="5_3" class="name_5"><span id="6_2" class="name_6">Can add some </span>more content here.</span> </p> <p> <span id="5_4" class="name_5">Sample content </span>Some text here. Some content here. </p> <p> <span id="7_1" class="name_7">This is a complex data.</span> <span id="8_1" class="name_8"><span id="7_2" class="name_7">Framing a long sentence to </span></span><span id="8_2" class="name_8">accomodate all possible </span>scenarios. </p> <p> <span id="9_1" class="name_9">More data can be <span><span id="10_1" class="name_10"><span id="9_2" class="name_9">added here.</span></span> </p> <p> <span id=10_2 class="name_10"><span id="9_3" class="name_9">Trying to include here.</span></span> </p> <p> <span id=10_3 class="name_10"><span id="9_4" class="name_9">Modifying</span></span><span id="10_4" class="name_10">content </span>here. </p> </body> </html> Thanks.

    Read the article

  • Adding <span> tags to all text nodes between custom self closing tags.

    - by Rachel
    I have a pair of custom self closing tags s1 and s2 defined in namespace x in my xhtml. For each tag pair s1, s2 having the same id, I want to add span tags to all the text nodes between them. Each s1, s2 tag pair have a unique id. The s1 tag has an attribute 'styleName' which needs to be copied as the class name for the span tags populated for the s1,s2 pair. Within a s1, s2 tag pair, other s1, s2 tags can occur. It is the id attribute of the tags s1 and s2 that help us to find the postion from where we need to start populating the span(for text nodes alone) and the end where we need to stop. In case of common text nodes that is part of the multiple s1, s2 pairs then the span tags needs to be opened and closed appropirately as shown in the sample below. I am not specific with the format of the id populated for the span tag. As long as it is unique it is fine. Can we achieve this kind of a solution using XSL. I am looking for a XSL based solution for the same. I am using Saxon java processor for XSL. I am trying to achieve this using XSL 2.0. Please share your ideas on this. EDIT: I have edited my sample input and output to make my question more clear. Sample input: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:x="http://sample.org"> <head> <title>This is my title</title> </head> <body> <h1 align="center">This <x:s1 id="1" styleName="name_1"/>is my <x:s2 id="1" />heading</h1> <p> Sample content <x:s1 id="2" styleName="name_2"/> Some text here. </p> <p> Here you <x:s2 id="2" />go. </p> <p> <x:s1 id="3" styleName="name_3"/>This <x:s1 id="4" styleName="name_4"/>is just a simple text <x:s2 id="4" />Some text here.<x:s2 id="3" /> Some content here. </p> <p> Use this <x:s1 id="5" styleName="name_5"/>space. </p> <p> Indroducing <x:s1 id="6" styleName="name_6"/> more information. </p> <p> Can add some <x:s2 id="6" />more content here. </p> <p> Sample content <x:s2 id="5" />Some text here. Some content here. </p> <p> <x:s1 id="7" styleName="name_7"/>This is a complex data. <x:s1 id="8" styleName="name_8"/>Framing a long sentence to <x:s2 id="7" />accomodate all possible <x:s2 id="8" />scenarios. </p> <p> <x:s1 id="9" styleName="name_9"/>More data can be <x:s1 id="10" styleName="name_10"/>added here. </p> <p> Trying to include here. </p> <p> Modifying <x:s2 id="9" />content <x:s2 id="10" />here. </p> </body> </html> Sample output: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:x="http://sample.org"> <head> <title>This is my title</title> </head> <body> <h1 align="center">This <span id="1_1" class="name_1">is my </span>heading</h1> <p> Sample content <span id="2_1" class="name_2"> Some text here.</span> </p> <p> <span id="2_2" class="name_2">Here you </span>go. </p> <p> <span id="3_1" class="name_3">This <span id="4_1" class="name_4">is just a simple text </span>Some text here.</span> Some content here. </p> <p> Use this <span id="5_1" class="name_5">space.</span> </p> <p> <span id="5_2" class="name_5">Indroducing <span id="6_1" class="name_6"> more information.</span></span> </p> <p> <span id="5_3" class="name_5"><span id="6_2" class="name_6">Can add some </span>more content here.</span> </p> <p> <span id="5_4" class="name_5">Sample content </span>Some text here. Some content here. </p> <p> <span id="7_1" class="name_7">This is a complex data.</span> <span id="8_1" class="name_8"><span id="7_2" class="name_7">Framing a long sentence to </span></span><span id="8_2" class="name_8">accomodate all possible </span>scenarios. </p> <p> <span id="9_1" class="name_9">More data can be <span><span id="10_1" class="name_10"><span id="9_2" class="name_9">added here.</span></span> </p> <p> <span id=10_2 class="name_10"><span id="9_3" class="name_9">Trying to include here.</span></span> </p> <p> <span id=10_3 class="name_10"><span id="9_4" class="name_9">Modifying</span></span><span id="10_4" class="name_10">content </span>here. </p> </body> </html> Thanks.

    Read the article

  • Actual element tags are not getting captured.

    - by user323719
    I am using the below piece of XSL code to construct a span tag calling a javascript function on mouseover. The input to the javascipt should be a html table. The output from the variable "showContent" gives just the text content but not along with the table tags. How can this be resolved. XSL: <xsl:variable name="aTable" as="element()*"> <table border="0" cellspacing="0" cellpadding="0"> <xsl:for-each select="$capturedTags"> <tr><td><xsl:value-of select="node()" /></td></tr> </xsl:for-each> </table> </xsl:variable> <xsl:variable name="start" select='concat("Tip(&#39;", "")'></xsl:variable> <xsl:variable name="end" select='concat("&#39;)", "")'></xsl:variable> <xsl:variable name="showContent"> <xsl:value-of select='concat($start,$aTable,$end)'/> </xsl:variable> <span xmlns="http://www.w3.org/1999/xhtml" onmouseout="{$hideContent}" onmouseover="{$showContent}" id="{$textNodeId}"><xsl:value-of select="$textNode"></xsl:value-of></span> Actual Output: <span onmouseout="UnTip()" onmouseover="Tip('content1')" id="d1t14"is my </span Expected output: <span onmouseout="UnTip()" onmouseover="Tip('<table><tr><td>content1</td></tr>')" id="d1t14">is my </span> What is the change that needs to done in the above XSL for the table, tr and td tags to get passed?

    Read the article

  • Why don't all XSLT templates get executed at once?

    - by Matt W
    Refer to: http://stackoverflow.com/questions/1613454/retrieving-one-element-and-filter-by-another In the above linked posting, I don't understand why the two template blocks don't get executed upon in the incoming XML at the same time. As far I can can see, the XSL risks the second template executing for every Document element whether it is called with apply-templates or not. Could someone explain this to my stifled brain, please? Thanks, Matt.

    Read the article

  • XSLT, JSTL e JSF

    - by Paulo S.
    I have a xml file which I want to transform in a jsf code page. To do that I've created a xsl file. xml: <?xml version='1.0' encoding='ISO-8859-1'?> <questionario xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='Schema2.xsd'> <componente nome='input'> <id>input1</id> </componente> <componente nome='input'> <id>input2</id> </componente> </questionario> code: <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x" %> <c:set var="xml" value="${questionarioXSLBean.xml}"/> <c:set var="xsl"> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" exclude-result-prefixes="f h"> <xsl:template match="/"> <xsl:for-each select="questionario/componente"> <xsl:if test="attribute::nome = 'input'"> <xsl:variable name="id"> <xsl:value-of select="id" /> </xsl:variable> <h:inputText id="{$id}"/> </xsl:if> </xsl:for-each> </xsl:template> </xsl:stylesheet> </c:set> <x:transform xml="${xml}" xslt="${xsl}" /> The problem is that nothing is shown in my screen because the generated code for <h:inputText id="input1"/> is <h:inputText id="input_1" xmlns:h="http://java.sun.com/jsf/html"/> how can I replace the xmlns:h="http://java.sun.com/jsf/html" or suppress it. Thanks! Update: Let me clarify what I want to do. I want to generate a jsf page dynamically depending on the attributes of a xml file, for instance, 2 input texts, 3 check boxes, etc. To make the transformation to jsf I thought in two approaches, one using jstl and another using xslt. The problem with the former is that I couldn't integrate jstl with jsf code (to set jsf components attributes using jstl variables) and with the last approach, I'm facing the problem described above.I wouldn't like to create components in java (UIComponents). Any suggestions?

    Read the article

  • How do i select the preceding nodes of a text node starting from a specific node and not the root no

    - by Rachel
    How do i select the preceding nodes of a text node starting from a specific node whose id i know instead of getting the text nodes from the root node? When i invoke the below piece from a template match of text node, I get all the preceding text nodes from the root. I want to modify the above piece of code to select only the text nodes that appear after the node having a specific id say 123. i.e something like //*[@id='123'] <xsl:template match="text()[. is $text-to-split]"> <xsl:variable name="split-index" as="xsd:integer" select="$index - sum(preceding::text()/string-length(.))"/> <xsl:value-of select="substring(., 1, $split-index - 1)"/> <xsl:copy-of select="$new"/> <xsl:value-of select="substring(., $split-index)"/> </xsl:template> <xsl:variable name="text-to-split" as="text()?" select="descendant::text()[sum((preceding::text(), .)/string-length(.)) ge $index][1]"/> How do i include the condition in places where i use preceding::text inorder to select preceding text nodes relative to the specific node's id which i know?

    Read the article

  • Improving the performance of XSL

    - by Rachel
    I am using the below XSL 2.0 code to find the ids of the text nodes that contains the list of indices that i give as input. the code works perfectly but in terms for performance it is taking a long time for huge files. Even for huge files if the index values are small then the result is quick in few ms. I am using saxon9he Java processor to execute the XSL. <xsl:variable name="insert-data" as="element(data)*"> <xsl:for-each-group select="doc($insert-file)/insert-data/data" group-by="xsd:integer(@index)"> <xsl:sort select="current-grouping-key()"/> <data index="{current-grouping-key()}" text-id="{generate-id( $main-root/descendant::text()[ sum((preceding::text(), .)/string-length(.)) ge current-grouping-key() ][1] )}"> <xsl:copy-of select="current-group()/node()"/> </data> </xsl:for-each-group> </xsl:variable> In the above solution if the index value is too huge say 270962 then the time taken for the XSL to execute is 83427ms. In huge files if the index value is huge say 4605415, 4605431 it takes several minutes to execute. Seems the computation of the variable "insert-data" takes time though it is a global variable and computed only once. Should the XSL be addessed or the processor? How can i improve the performance of the XSL.

    Read the article

  • DOCTYPE declaration getting lost when using XSL

    - by Rachel
    The input to my XSL is an XHTML. After applying the XSL the DOCTYPE declaration that was present in the input XHTML gets lost in the output. Do i have an option to copy/retain the DOCTYPE declaration in the output using XSL. The XSL processor that i am using is SAXON.

    Read the article

  • How do i modify the text content within a specified set of nodes using XSL?

    - by user323719
    I have a list of node ids. I want to append "-Selected" to all the text nodes within the given set of node ids. Please let me know how we can achieve the same using XSL? Input: <node1 id="a"> <node2 id="b"> <node3 id="c" /> <node4 id="d"> <node5 id="e">Text node1</node5> <node6 id="f">Text node2</node6> </node4> </node2> <node7 id="g">Text node3 <node8 id="h" align="center">Text node4</node8> <node9 id="i">Text node5</node9> </node7> <node10 id="j">Text node6 </node10> <node11 id="h">Text node7 </node11> Input Param: List of node ids <xsl:param name="pNodes"> <nodes> <node>4</node> <node>7</node> <node>11</node> </nodes> Expected output: <node1 id="a"> <node2 id="b"> <node3 id="c" /> <node4 id="d"> <node5 id="e">Text node1 - Selected</node5> <node6 id="f">Text node2 - Selected</node6> </node4> </node2> <node7 id="g">Text node3 <node8 id="h" align="center">Text node4 - Selected</node8> <node9 id="i">Text node5 - Selected</node9> </node7> <node10 id="j">Text node6 </node10> <node11 id="h">Text node7 - Selected </node11>

    Read the article

  • How do you use Exslt.dyn (especially the 'evaluate' method) in Umbraco?

    - by jeffreypriebe
    I am trying to execute the string contained in an XSL variable. Umbraco has hooks for several Exslt pieces, but it seems the Exslt.dyn (Exslt.dynamic) is not one of them. How do you add it in? Acceptable methods (in order of preference: Writing your own XSLT extension (possibly using existing Umbraco code for Exslt Dynamic). Uploading the XSL from http://www.exslt.org/dyn/functions/evaluate/index.html into Umbraco. Modifying the Umbraco source to add it (possibly using existing Umbraco code for Exslt Dynamic). The reason I mention Exslt Dyanmic is because some Umbraco XSLT sources show a reference that I am assuming existing in some versions of Umbraco. I cannot find it in the source code, however. (Example: the XSL sources pasted in here: http://our.umbraco.org/projects/starter-kits/business-website-starter-pack/general-%28bugs,-feedback,-feature-requests%29/8085-Changing-the-first-day-to-fx-monday)

    Read the article

1 2  | Next Page >