xslt-2.0

Evaluate dynamic string as an XPath expression?

孤街醉人 提交于 2019-11-29 16:49:08
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 in the XSLT (file xslunit-xslt2.xsl ). But I can't find a way to evaluate an XPath. Though, it may be

XSLT 2.0: Transform notation in plain text to svg

别说谁变了你拦得住时间么 提交于 2019-11-29 15:10:15
I am new to transformations between different formats. My goal is to transfer a notation from a toolkit which is in a plain text format to svg. An easy example would be that I have an orange ellipse and the notation would be like this (x and y is the coordinate system so 0 and 0 means the ellipse is in the middle): GRAPHREP PEN color:$000000 w:2pt FILL color:$ff7f00 ELLIPSE x:0pt y:0pt rx:114pt ry:70pt and my desired output would be an svg code something like this(the cx and cy coordinate are randomly selected for the example): <svg width="400" height="400" xmlns="http://www.w3.org/2000/svg"

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

吃可爱长大的小学妹 提交于 2019-11-29 13:35:36
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 HTML will serialize as HTML, so the output may not be well-formed XML. If you are only sending to browsers and don't care

how to use xslt 2.0 in visual studio 2010

北城余情 提交于 2019-11-29 13:13:41
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 yet implemented xsl:function is not yet implemented xsl:param/@as is not yet implemented xsl:for-each

convert xml to jsonx using xslt

大兔子大兔子 提交于 2019-11-29 12:04:28
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</json:string> <json:string name="Password"/> </json:object> <json:object> <json:string name="Name">john<

xsl:for-each-group help needed

眉间皱痕 提交于 2019-11-29 11:44:25
I went through XSLT Grouping Examples and Using for-each-group for high performance XSLT . I have a problem with for-each-group. My XML <?xml version="1.0" encoding="UTF-8"?> <body> <p name="h-title" other="main">Introduction</p> <p name="h1-title " other="other-h1">XSLT and XQuery</p> <p name="h2-title" other=" other-h2">XSLT</p> <p name=""> <p1 name="bold"> XSLT is used to write stylesheets.</p1> </p> <p name="h2-title " name="other-h2">XQuery</p> <p name=""> <p1 name="bold"> XQuery is used to query XML databases.</p1> </p> <p name="h3-title" name="other-h3">XQuery and stylesheets</p> <p

Flat to Nested structure based on attribute value using XSLT

强颜欢笑 提交于 2019-11-29 10:53:06
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 id="r6"/> </r> </r> </r> <r id="r7"> <r id="r8"> <r id="r9"/> </r> </r> </rs> What I have tried is the

What is the default select of XSLT apply-templates?

≡放荡痞女 提交于 2019-11-29 09:21:07
The identity template looks like this: <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()" /> </xsl:copy> </xsl:template> Does <xsl:apply-templates select="@*|node()" /> select more than <xsl:apply-templates /> , or could the identity template have been like this? <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates /> </xsl:copy> </xsl:template> What exactly is selected when I do the following? <xsl:apply-templates /> Does <xsl:apply-templates select="@*|node()" /> select more than <xsl:apply-templates /> , or could the identity template have been

how to get the most deeply nested element nodes using xpath? (implementation with XMLTWIG)

偶尔善良 提交于 2019-11-29 07:48:57
I need to extract (XSLT, xpath, xquery... Preferably xpath) the most deeply nested element nodes with method (DEST id="RUSSIA" method="delete"/>) and his direct ancestor (SOURCE id="AFRICA" method="modify">). I don't want to get the top nodes with methods ( main method="modify"> or main method="modify"> ). The deepest nested elements with method correspond to real actions. The top elements with method actually are dummy actions that must not be taken into account. Here is my XML sample file: <?xml version="1.0" encoding="UTF-8"?> <main method="modify"> <MACHINE method="modify"> <SOURCE id=

Using XSLT to translate an XML file

梦想与她 提交于 2019-11-29 07:41:04
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). Can you give me advice how to formulate an XSLT? I was thinking of using <xsl:key> for this but I never