xslt-2.0

Populate XML template-file from XPath Expressions?

我是研究僧i 提交于 2019-11-30 16:52:04
What would be the best way to populate (or generate) an XML template-file from a mapping of XPath expressions? The requirements are that we will need to start with a template (since this might contain information not otherwise captured in the XPath expressions). For example, a starting template might be: <s11:Envelope xmlns:s11='http://schemas.xmlsoap.org/soap/envelope/'> <ns1:create xmlns:ns1='http://predic8.com/wsdl/material/ArticleService/1/'> <article xmlns:ns1='http://predic8.com/material/1/'> <name>?XXX?</name> <description>?XXX?</description> <price xmlns:ns1='http://predic8.com/common

Convert dateTime to unix epoch in xslt

混江龙づ霸主 提交于 2019-11-30 14:53:29
问题 I have a dateTime variable, and I want to convert it to a decimal value of epoch. How can this be done? I tried using: seconds-from-duration($time, xs:dateTime('1970-01-01T00:00:00')) but it just returns 0. Please advice. Thanks. 回答1: This transformation : <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xsl:output method="text"/> <xsl:template match="/"> <xsl:sequence select="current-dateTime()"/> <xsl:sequence

Convert dateTime to unix epoch in xslt

偶尔善良 提交于 2019-11-30 12:09:41
I have a dateTime variable, and I want to convert it to a decimal value of epoch. How can this be done? I tried using: seconds-from-duration($time, xs:dateTime('1970-01-01T00:00:00')) but it just returns 0. Please advice. Thanks. This transformation : <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xsl:output method="text"/> <xsl:template match="/"> <xsl:sequence select="current-dateTime()"/> <xsl:sequence select= "( current-dateTime() - xs:dateTime('1970-01-01T00:00:00') ) div xs:dayTimeDuration('PT1S') "/> </xsl

how to use xslt 2.0 in visual studio 2010

孤人 提交于 2019-11-30 09:11:01
问题 I am using xslt 2.0 for transforming one xml format to another xml format.But Visual Studio 2010 supports only xslt1.0. So, I referred the stackoverflow link and followed the procedure they said.But it did not working for me... http://zeetalks.wordpress.com/2011/07/26/vs2010-adding-xslt-to-visual-studio-2010/ XSLT 2.0 intellisense in Visual Studio 2010 - Adding a schema? When i opening my xslt 2.0 xsl file in VS-2010 then it raised following 5 Errors.They are... xpath-default-namespace is not

how to parse the xml inside CDATA of another xml using xslt?

随声附和 提交于 2019-11-30 08:40:27
问题 I need to transform the XML inside the CDATA of the XML using the single XSLT. I have an XML as below with xml inside the CDATA as in the below xml. <message channel-id="e01db0aa-b3db-4b6c-a055-7a0d5c1d1f20" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" > <send-parameters> <agent-parameter multi-valued="false"> <name>Networks</name> <value><![CDATA[<Networks> <Network> <GroupCode>EXTPRI</GroupCode> <NetworkTypeId>LANI</NetworkTypeId> <OrgNetworkPlatformName>EON-0cbu0cust12301dcd-D

XSLT: Finding last occurence in a string

久未见 提交于 2019-11-30 08:31:25
问题 Given a form number like: ABC_12345_Q-10 I want to end up with: ABC12345 So I need to find the position of the second underscore Note that there is no standard pattern or length to any of the "sections" between the underscores (so I cannot use substring to simply eliminate the last section). xPath 2.0 solutions are okay. 回答1: concat( substring-before($s, '_'), substring-before(substring-after($s, '_'), '_') ) Alternatively: string-join(tokenize($s, '_')[position() <= 2], '') 回答2: @Pavel

How can I use XSLT 2.0 and XSLT 3.0 in Java?

不羁的心 提交于 2019-11-30 05:58:15
问题 I am able to use XSLT 1.0 in Java as shown in the folllowing example :- copy.xml <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="identityxfm.xsl"?> <catalog> <book id="bk101"> <author>Gambardella, Matthew</author> <title>XML Developer's Guide</title> <genre>Computer</genre> <price>44.95</price> <publish_date>2000-10-01</publish_date> <description>An in-depth look at creating applications with XML.</description> </book> <book id="bk102"> <author>Ralls, Kim</author> <title>Midnight

How to select saxon TransformerFactory in Java

三世轮回 提交于 2019-11-29 21:43:57
In my web application I need to use Saxon TransformerFactory in order to use XSLT 2.0 but I can't use setProperty method because I don't have this right on the web server and there is a Security Manager. So I have read that it should be possible to do this: Use the Services API (as detailed in the JAR specification), if available, to determine the classname. The Services API will look for a classname in the file META-INF/services/javax.xml.transform.TransformerFactory in jars available to the runtime. I found this file in WEB-INF/lib/saxon9.jar but when I istantiate a TransformerFactory, the

xslt 2.0 tokenize and group

主宰稳场 提交于 2019-11-29 18:17:05
I have an text file with following data: <t>Heros Firstname Sean Lastname Connery DOB 25-08-1930 Films Dr.No 1962 Goldfinger 1964 Thunerball 1965 Award name Academy time 1 Award name BAFTA time 2 Award name Gloden Globes time 3</t> Expected output should look like: <Jamesfilms> <heros> <firstName>Sean</firstName> <lastName>Connery</lastName> <DOB>25-08-1930</DOB> </heros> <films> <Dr.No>1962</Dr.No> <Goldfinger>1964</Goldfinger> <Thunerball>1965</Thunerball> </films> <award> <name>Academy</name> <times>1</times> </award> <award> <name>BAFTA</name> <times>2</times> </award> <award> <name>Gloden

Convert 31-DEC-2016 to 2016-12-31

北慕城南 提交于 2019-11-29 17:38:21
I want to convert the 31-DEC-2016 i.e., dd-mmm-yyyy to yyyy-mm-dd in the XSLT using format-dateTime function but the output is not as expected.Can anyone help on this? <ns1:QuoteDate> <xsl:value-of select='concat(xp20:format-dateTime(/Quote/QuoteHeader/QuoteDate,"[Y0001]-[M01]-[D01]"),"T00:00:00")'/> </ns1:QuoteDate> I want to get the value for this particular thing.31-DEC-2016 : This is the input and i have to transform over here in the code Once that is converted, How to concat the the value T00:00:00 to the date?? You cannot use the format-dateTime() function on a string that is not a valid