xslt-1.0

How to find nodes with same children

…衆ロ難τιáo~ 提交于 2019-12-10 10:18:01
问题 I have following xml. Note that node n1 and n3 have same children (order can be different). How can I write an XSL transformation to identify such nodes? <Document> <Node name="n1"> <Item value="v1"> <Item value="v2"> <Item value="v3"> </Node> <Node name="n2"> <Item value="p1"> <Item value="p2"> <Item value="p3"> </Node> <Node name="n3"> <Item value="v3"> <Item value="v1"> <Item value="v2"> </Node> </Document> 回答1: Here is a complete XSLT 1.0 solution that is general enough so that it would

Sort data in the xml alphabetical order

雨燕双飞 提交于 2019-12-10 10:16:43
问题 Input XML : <?xml version="1.0" encoding="utf-8" ?> <infoset> <info> <title>Bill</title> <group> <code>state</code> </group> </info> <info> <title>Auto</title> <group> <code>state</code> </group> </info> <info> <title>Auto2</title> </info> <info> <title>Auto3</title> </info> <info> <title>Auto5</title> </info> <info> <title>Certificate</title> <group> <code>Auto4</code> </group> </info> </infoset> Expected output : A Auto2 Auto3 Auto4 Certificate Auto5 S state Auto Bill I need to arrange the

Call XSLT template and save all output to variable

爷,独闯天下 提交于 2019-12-10 09:29:55
问题 I want to call and template and save the output to a variable. I want to save ALL of the output including HTML markup, but that's not what happens. For example, take this simple XSLT: <xsl:call-template name="demonstration"> <xsl:template name="demonstration"> <p>Just a test</p> </xsl:template> This simple template will output <p>Just a test</p> to the HTML page. If I view the page source, I see that (of course). Now take this example using the same template, but instead of just outputting to

Dynamically include other XSL files in XSLT

北城余情 提交于 2019-12-10 03:54:31
问题 I have a small problem, is there a way to dynamically include another xsl? For example: <xsl:variable name="PathToWeb" select="'wewe'"/> <xsl:include href="http://{$PathToWeb}/html/xsl/head.xsl" /> <xsl:include href="http://{$PathToWeb}/html/xsl/navigation.xsl" /> <xsl:include href="http://{$PathToWeb}/html/xsl/promo.xsl" /> <xsl:include href="http://{$PathToWeb}/html/xsl/3columns.xsl" /> <xsl:include href="http://{$PathToWeb}/html/xsl/footer.xsl" /> 回答1: I have a small problem, is there a

XSLT1.0 Rendering sequence of different elements stored in a variable as M x N table

北城以北 提交于 2019-12-09 06:51:28
I have the following XML (it is simplified and most attributes are omitted): <Document> <Transfer Name="" From="" To=""/> <Transfer Name="" From="" To=""/> <OtherElement/> <OtherElement/> <Flight AirLina="" From="" To=""/> <Flight AirLina="" From="" To=""/> <OtherElement/> <Hotel Name="" Duration=""/> <Hotel Name="" Duration=""/> <OtherElement/> <OtherElement/> <Extras Name="" Price=""/> <Extras Name="" Price=""/> <Extras Name="" Price=""/> <Extras Name="" Price=""/> <Extras Name="" Price=""/> <Extras Name="" Price=""/> <OtherElement/> <OtherElement/> </Document> I have a variable, containing

Does XSLT have any concept of an array?

橙三吉。 提交于 2019-12-09 03:25:26
问题 I have never really used XSLT before and am looking for some advice. I have the following items returned in XML from GSA box: <MT N="searchCategories" V="Category 1"/> <MT N="searchCategories" V="Category 2"/> etc etc There can be any amount of these categories. I am just wondering if XSLT has any concept of an array? If so: How could I enumerate all the nodes above into an array? How would I get the length of the array? If not: Is there any work around available? I believe I am using XSLT

Need to remove <?xml version=“1.0” encoding=“utf-16”?> from the xml

无人久伴 提交于 2019-12-09 00:21:06
问题 Hi i am generating a xml by appying the xsl to a xml input. I need the output without this part "<?xml version="1.0" encoding="utf-16"?>" input--xml <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <CreateResponse xmlns="http://jerseytelecom.com/"> <CreateResult> <ISD_XMLGateway> <Entity>RIM_BPS</Entity> </ISD_XMLGateway> <

XSLT: Sort by the lower of 2 values

烈酒焚心 提交于 2019-12-08 17:39:58
问题 I have some XML that is formatted as follows: <products> <product> <name>Product 1</name> <price> <orig>15</orig> <offer>10</offer> </price> </product> <product> <name>Product 2</name> <price> <orig>13</orig> <offer>12</offer> </price> </product> <product> <name>Product 3</name> <price> <orig>11</orig> </price> </product> </products> I need to sort the products using XSLT 1.0 (in either ascending or descending order) based on their current price. My difficulty lies in the fact that I need to

Return all XML element taken one time in a node

不羁的心 提交于 2019-12-08 14:00:04
问题 Each node contains a list of colour in the field LIGHT_COLOUR, identied by a letter R(red), W(white), etc etc. In the field LIGHT_COLOUR can be only one colour/letter or more than one separated by '-'. This is my XML for testing: <LIGHT_INFORMATION_LIST> <LIGHT_INFORMATION> <LIGHT_CHARACTERISTICS>Al</LIGHT_CHARACTERISTICS> <LIGHT_COLOUR>W-G</LIGHT_COLOUR> </LIGHT_INFORMATION> <LIGHT_INFORMATION> <LIGHT_CHARACTERISTICS>Al</LIGHT_CHARACTERISTICS> <LIGHT_COLOUR>W-R</LIGHT_COLOUR> </LIGHT

xslt string replace concrete example

限于喜欢 提交于 2019-12-08 13:41:31
问题 I've found the template Codesling has provided as a substitute to the replace-function in XSLT 1.0: XSLT string replace The problem I'm having is that I cannot figure out how to adapt it to my concrete example, so I'm hoping for some pointers here. I've got a xml-parameter called ./bib-info that looks like this (for example): <bib-info>Gäbler, René, 1971- [(DE-588)138691134]: Schnell-Umstieg auf Office 2010, [2010]</bib-info> My goal is to replace the blanks between the "]:" and the beginning