xpath-2.0

xpath dates comparison

孤人 提交于 2019-11-27 08:53:06
I'm trying to filter elements based on an attribute that is a date in the format yyyy-MM-dd . My XML looks like this: <?xml version="1.0" encoding="utf-8"?> <root> <article title="wired" pub-date="2010-11-22" /> <article title="Plus 24" pub-date="2010-11-22" /> <article title="Finance" pub-date="2010-10-25" /> </root> My xpath attempt: '//article[xs:date(./@pub-date) > xs:date("2010-11-15")]' Using xpath 2.0 - would avoid adding a schema unless absolutely necessary. From comments : I believe I must be missing something then. Is it possible that I need to specify something else for xs:date to

Finding the difference between 2 dates in xslt

杀马特。学长 韩版系。学妹 提交于 2019-11-27 02:23:34
问题 Is there a less then kludgey way of finding the difference in days between 2 dates in xslt? If so can you point me in the right direction. I am receiving dates in the format of mm/dd/yyyy. 回答1: Use XSLT 2.0 (XPath 2.0) for this : <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:my="my:my"> <xsl:output omit-xml-declaration="yes" indent="yes"/> <xsl:template match="/"> <xsl:variable name="vDate1" select="my

What browsers support Xpath 2.0?

不羁岁月 提交于 2019-11-26 16:39:58
问题 I have recently been working with XPath and have been searching for information on which browsers support XPath 2.0 without much luck. The best I could find was the query technologies comparison table of various rendering engines. This clearly tells me that Firefox and IE (all versions of both) do not support XPath 2.0, but what about the other rendering engines for Chrome, Safari, etc.? Does anybody have any information on this or know where one can find it? 回答1: I do not know of any, and

xpath dates comparison

蓝咒 提交于 2019-11-26 14:20:49
问题 I'm trying to filter elements based on an attribute that is a date in the format yyyy-MM-dd . My XML looks like this: <?xml version="1.0" encoding="utf-8"?> <root> <article title="wired" pub-date="2010-11-22" /> <article title="Plus 24" pub-date="2010-11-22" /> <article title="Finance" pub-date="2010-10-25" /> </root> My xpath attempt: '//article[xs:date(./@pub-date) > xs:date("2010-11-15")]' Using xpath 2.0 - would avoid adding a schema unless absolutely necessary. From comments : I believe

How do you identify duplicate values in a numerical sequence using XPath 2.0?

北城以北 提交于 2019-11-26 11:27:20
问题 I have an XPath expression which provides me a sequence of values like the one below: 1 2 2 3 4 5 5 6 7 It is easy to convert this to a set of unique values 1 2 3 4 5 6 7 using distinct-values() . However, what I want to extract is the list of duplicate values = 2 5 . I can\'t think of an easy way to do this. Can anyone help? 回答1: Use this simple XPath 2.0 expression : $vSeq[index-of($vSeq,.)[2]] where $vSeq is the sequence of values in which we want to find the duplicates. For explanation of

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