xslt-2.0

Finding the difference between two dateTimes in XSLT

99封情书 提交于 2019-11-26 11:34:07
问题 I have an XML file which includes some dates with start and end points, like shown as follows: <start time=\"2016-02-21T00:59:06+02:00\"/> ..... ..... <end time=\"2016-02-22T02:24:38+02:00\"/> Question: How to calculate the difference between two time attributes? 回答1: I am getting the error: ... xsl:version: only 1.0 features are supported Here's a purely XSLT 1.0 solution: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0"

What browsers support XSLT 2.0?

白昼怎懂夜的黑 提交于 2019-11-26 11:16:23
问题 The Safari browser does not support XSLT 2.0 documents. What browsers, if any, support XSLT 2.0? 回答1: Browsers do not yet support XSLT 2.0, natively. Saxon 9 CE is a JavaScript-based XSLT 2.0 implementation. Frameless is another, more light-weight XSLT 2.0 implementation in the browser, supporting large parts of the XSLT 2.0 and XPath 2.0 functionality See also: How can I make XSLT work in chrome? https://developer.mozilla.org/en/docs/XSLT_2.0 http://blogs.msdn.com/b/dareobasanjo/archive/2004

Will XPath 2.0 and/or XSLT 2.0 be implemented in PHP?

安稳与你 提交于 2019-11-26 09:46:21
问题 The question was asked but deleted by the asker before it received an answer. Because I believe the question is sound and legitimate and serves a purpose, I\'m asking it again and provide the answer I already wrote for the original question. Will XPath 2.0 and/or XSLT 2.0 be implemented in PHP some day or are there any plans? 回答1: See this list of XSLT engines, from a thread on an XSL mailing list regarding XSLT 2.0 development. A solution for PHP is to use the PHP/Java Bridge and Saxon, and

Multiply 2 numbers and then sum

主宰稳场 提交于 2019-11-26 09:12:18
问题 I am having a difficult time trying to do something that seems like it should be really easy to do. I basically want to multiply 2 numbers in a node and then sum the total of those numbers for all the nodes. Here is the XSLT code I have tried. <xsl:value-of select=\"sum(Parts/Part/Quantity * Parts/Part/Rate)\"/> This code results in an error that says \"Argument 1 of function sum cannot be converted to a node set.\" Does anyone have an idea of what is wrong or how I can accomplish what I am

Check if a string is null or empty in XSLT

跟風遠走 提交于 2019-11-26 07:52:16
问题 How can I check if a value is null or empty with XSL? For example, if categoryName is empty? I\'m using a when choosing construct. For example: <xsl:choose> <xsl:when test=\"categoryName !=null\"> <xsl:value-of select=\"categoryName \" /> </xsl:when> <xsl:otherwise> <xsl:value-of select=\"other\" /> </xsl:otherwise> </xsl:choose> 回答1: test="categoryName != ''" Edit : This covers the most likely interpretation, in my opinion, of "[not] null or empty" as inferred from the question, including it

XSL xsl:template match=“/”

你。 提交于 2019-11-26 06:56:03
问题 I am just learning XML and how to use XSL files. In an XSL file I found the following term: xsl:template match=\"/\" What does this stand for? And what could I use instead of the / ? Could I write table or any other HTML tag instead of / ? 回答1: The value of the match attribute of the <xsl:template> instruction must be a match pattern . Match patterns form a subset of the set of all possible XPath expressions . The first, natural, limitation is that a match pattern must select a set of nodes.

How to remove elements from xml using xslt with stylesheet and xsltproc?

核能气质少年 提交于 2019-11-26 04:13:00
问题 I have a lot of XML files which have something of the form: <Element fruit=\"apple\" animal=\"cat\" /> Which I want to be removed from the file. Using an XSLT stylesheet and the Linux command-line utility xsltproc, how could I do this? By this point in the script I already have the list of files containing the element I wish to remove, so the single file can be used as a parameter. EDIT: the question was originally lacking in intention. What I am trying to achieve is to remove the entire

Why does XSLT output all text by default?

家住魔仙堡 提交于 2019-11-26 00:58:23
问题 Hi I had performed a transformation which drops a tag if it is null. I wanted to check whether my transformation is working fine, so instead of checking it manually, I wrote one more XSLT code which just checks the presence of that particular tag in the OUTPUT XML, if it is null, then the second XSLT should output a text \"FOUND\". (I don\'t actually need some XML kind of output but I am just using XSLT for searching.) When I tried with this XSL code :: <xsl:stylesheet version=\"1.0\" xmlns

Why does XSLT output all text by default?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-25 20:53:14
Hi I had performed a transformation which drops a tag if it is null. I wanted to check whether my transformation is working fine, so instead of checking it manually, I wrote one more XSLT code which just checks the presence of that particular tag in the OUTPUT XML, if it is null, then the second XSLT should output a text "FOUND". (I don't actually need some XML kind of output but I am just using XSLT for searching.) When I tried with this XSL code :: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/SiebelMessage//SuppressCalendar[.!='']">