xslt-2.0

Can one give me the example for “mode” of template in xsl?

人走茶凉 提交于 2019-11-28 16:47:36
In <xsl:template name="temp_name" mode="mode"> What is the meaning of mode ? I searched many many resource, but i couldn't find example for that. So can anybody explain with an example? It isn't too meaningful to give a template both a name and a mode . The name attribute fully identifies a template and there cannot be two templates with the same name and different modes. The mode attribute allows the same nodes to be processed more than once, using different modes . Here is a short example: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output omit-xml

Upgrading XSLT 1.0 to XSLT 2.0

让人想犯罪 __ 提交于 2019-11-28 15:20:57
What is involved in upgrading from XSLT 1.0 to 2.0? 1 - What are the possible reasons for upgrading? 2 - What are the possible reasons for NOT upgrading? 3 - And finally, what are the steps to upgrading? I'm hoping for an executive summary--the short version :) What is involved in upgrading from XSLT 1.0 to 2.0? 1 - What are the possible reasons for upgrading? If you are an XSLT programmer you'll benefit largely from the more convenient and expressive XSLT 2.0 language + XPath 2.0 and the new XDM (XPath Data Model). You may want to watch this XSLT 2.0 Pluralsight course to get firm and

xslt 1 and sum function

China☆狼群 提交于 2019-11-28 12:51:05
I create an invoice management system using xml and PHP but the latest PHP version does not support XSLT 2.0 - therefore I have to look for an sum() alternative. How can I transform the valid xslt 2 function "sum(unitprice * quantity)" to xslt 1.0 ? The XML stuff is based on John's Examples I tried it with a node-set, but it is not supported "xmlXPathCompOpEval: function node-set not found in" Actually, sum(price*quantity) isn't valid XSLT 2.0 syntax. I guess you mean something like `sum(for $x in * return $x/price*$x/quantity). Summing over a computed value in XSLT 1.0 can be done in the

XSLT: Remove namespace prefix from elements

别等时光非礼了梦想. 提交于 2019-11-28 12:43:21
I need to remove the namespace prefix from an un-SOAP'd message. This is the message that has had the SOAP envelope removed. As you can see it contains ns1 prefix on the elements: <ns1:BookingSource xmlns:ns1="urn:EDI/Booking/artifacts"> <ns1:BookingHeader> <ns1:BookingNo>000123</ns1:BookingNo> <ns1:BookingDate>01/01/2012</ns1:BookingDate> <ns1:DSBookingDetail> <ns1:BookingNo>000123</ns1:BookingNo> <ns1:SeqNo>1</ns1:SeqNo> <ns1:LineType>Item</ns1:LineType> <ns1:ProductCode>Box</ns1:ProductCode> </ns1:DSBookingDetail> <ns1:DSBookingDetail> <ns1:BookingNo>000123</ns1:BookingNo> <ns1:SeqNo>2</ns1

XSL transformation - XML data to HTML table

扶醉桌前 提交于 2019-11-28 12:34:20
问题 Is there way how to create a XSL stylesheet for this type a XML document for output like HTML table on the picture below? The problem is, that generated datas are stored randomly in XML document, so I do not know how to write a stylesheet for it. Can you help me please? Thank you a lot. This is a XML document with random sort datas (Memory, CPU0, CPU1, CPU2). This data has two time (time=1 and time=14). <?xml version="1.0" encoding="UTF-8"?> <root> <sample time="14" label="cpu_0"> <value>22<

Evaluate dynamic string as an XPath expression?

。_饼干妹妹 提交于 2019-11-28 10:44:14
问题 Currently, I'm writing something to do Unit testing for XSLT2 functions, the idea is very simple: Create a custom-library.xsl , which contains some custom XSLT2 functions. Create a data XML contains the test cases, as following XML Schema xslunit.xsd: schema structure http://xml.bodz.net/schema/xslunit/xslunit.png Run the test cases by transform it, using xslunit-xslt2.xsl, and get the test result html. Now, the question is, there is function-call in the test cases, and I have to evaluate it

xml, html or xhtml in <xsl:output>: Which is the better choice?

眉间皱痕 提交于 2019-11-28 07:26:28
问题 For historic reasons we have a mixture of <xsl:output method="xml"> and <xsl:output method="html"> and <xsl:output method="xhtml"> inside an include-hierarchy of XSL files. Now we want to refactor so all XSL files use the same output method. In the end we want to produce XHTML-output so I suppose the latter would be the best choice. But what are the differences between those three output-methods and which would you use for what kind of solution? Edit: I'm using XSLT 2.0 回答1: HTML will

convert xml to jsonx using xslt

馋奶兔 提交于 2019-11-28 05:39:59
问题 Can anyone help me out in getting the below with an array..I have to generate the generalised xsl.. Input XML: <Login> <Groups> <Group> <Name>john</Name> <Password/> </Group> <Group> <Name>john</Name> <Password/> </Group> </Groups> </Login> Output: <json:object xmlns:json="http://www.ibm.com/xmlns/prod/2009/jsonx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <json:object name="Login"> <json:object name="Groups"> <json:array name="Group"> <json:object> <json:string name="Name">john<

Flat to Nested structure based on attribute value using XSLT

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-28 04:15:18
问题 I have a flat structured XML file as below: <rs> <r id="r1" lev="0"/> <r id="r2" lev="1"/> <r id="r3" lev="0"/> <r id="r4" lev="1"/> <r id="r5" lev="2"/> <r id="r6" lev="3"/> <r id="r7" lev="0"/> <r id="r8" lev="1"/> <r id="r9" lev="2"/> </rs> which I need to transform to a nested one. Rule is something, all r[number(@lev) gt 0] should be nested within r[number(@lev) eq 0] . And the output would be something like that: <rs> <r id="r1"> <r id="r2"/> </r> <r id="r3"> <r id="r4"> <r id="r5"> <r

Using XSLT to translate an XML file

馋奶兔 提交于 2019-11-28 01:36:24
问题 I want to translate a given XML file (it is a RelaxNG grammar) to other languages via XSLT. Suppose the XML file is: <?xml version="1.0" encoding="UTF-8"?> <grammar> <element name="table" /> <element name="chair" /> </grammar> Now I was thinking of having an XSLT stylesheet with the information like en=table, de=Tisch, fr=table en=chair, de=Stuhl, fr=chaise ... (there will be many, many more entries) But I could also put this information in to an external file (I am starting from scratch).