xslt-1.0

XSLT copy elements from second XML if not exist in the first XML

梦想的初衷 提交于 2019-12-11 21:10:18
问题 I have the following XMLs: car.xml: <car ref-id="parts.xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <color>red</color> <tire>michelin</tire> <engines> <engine> <model>Z</model> </engine> </engines> <hifi>pioneer</hifi> </car> parts.xml: <?xml version="1.0" encoding="UTF-8"?> <parts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <engines> <engine> <model>X</model> </engine> <engine> <model>Y</model> </engine> </engines> <tire>goodyear</tire> <color>black</color> <airbag

how to fetch the other tags by targeting a particular tag

人盡茶涼 提交于 2019-12-11 20:26:57
问题 Here I have pasted a sample of XML that was tag names like 21A,50F,21D,22B . Normally if I need to fetch a particular tag, I can use logic below easily in XSLT: <xsl:choose> <xsl:when test="tag[name = '21A'] "> <xsl:choose> <xsl:when test="substring(tag[name = '21A']/value,1,1) = '/'"> <xsl:variable name="result" select="concat(translate(tag[name = '21A']/value,',',' '),' ')"/> <xsl:value-of select="substring(substring-before(substring-after($result,' '),' '),1,11)"/> </xsl:when> <xsl:when

get max value of a node not working

雨燕双飞 提交于 2019-12-11 20:24:00
问题 i am trying to get max and min values of LandLine_ExtId base don the attribute action. the max value for Landline_ExtId with action value=del is returned wrong xml input <Landline_ExtId action='add'>771534777880</Landline_ExtId> <Landline_ExtId action='add'>771534777881</Landline_ExtId> <Landline_ExtId action='add'>771534777882</Landline_ExtId> <Landline_ExtId action='add'>771534777883</Landline_ExtId> <Landline_ExtId action='add'>771534777884</Landline_ExtId> <Landline_ExtId action='add'

how to extract the child element from nested tags using xslt

感情迁移 提交于 2019-12-11 19:49:28
问题 I have a scenario in xml : <body> <div><i>italic</i> <div id ="88"> <div id="4545"> <h3>hey h3</h3> <xyz>XYZ</xyz> </div> </div> </div> <div id="123"> <h1>Example</h1> <div id="1234"> <h1>heading 1</h1> <p>computer</p> <div> <i>italic 2</i> <div> <h3>heading 3</h3> </div> </div> </div> <div id="12345"> <h1>heading 1</h1> </div> </div> </body> I need to apply the rule that div converted to section and the div in which h1 value is Example ,delete that h1 tag and add attribute class=<value of

Reading a XML text and placing it in row using XSLT

人走茶凉 提交于 2019-12-11 19:44:49
问题 I have the XML file below. I need to output Type and Headline of Event elements that contain 'step' in their Headline and the step number. <?xml version="1.0" encoding="ISO-8859-1"?> <Testlog> <Event Timestamp="27-Dec-2012 04:25:12.247 PM" Type="Script End" Headline="Script end [DSE.DSEBalanceInquiry_FC.DseBalanceInquiry_FC_Test_003]" Result="WARNING"> <Property script_name="DSE.DSEBalanceInquiry_FC.DseBalanceInquiry_FC_Test_003"/> <Property script_id="DSE.DSEBalanceInquiry_FC

Saxon doesn't support `saxon:output` anymore

吃可爱长大的小学妹 提交于 2019-12-11 19:44:07
问题 I'm trying to use Saxon 9.1.0.8 HE to apply (recent) Docbook XSL, and getting this: Don't know how to chunk with SAXON 9.1.0.8 from Saxonica Processing terminated by xsl:message at line 46 in chunker.xsl Docbook XSL source claims that: <!-- This stylesheet works with XSLT implementations that support --> <!-- exsl:document, saxon:output, or Xalan's redirect:write --> <!-- Note: Only Saxon 6.4.2 or later is supported. --> ...and a visit to line 46 mentioned in the error message (which tests

missing second p tag how to get it

倾然丶 夕夏残阳落幕 提交于 2019-12-11 19:43:54
问题 I am not getting the second p tag in my xsl... providing my code below... http://xsltransform.net/b4GWV9/17 <xsl:for-each select="child::*"> <xsl:if test="normalize-space(.)!=''"> <p class="specifications__value-title"> <xsl:value-of select="." /> </p> </xsl:if> </xsl:for-each> providing my html output also below http://jsfiddle.net/F9wh7/ <li class="specifications__value"> <p class="specifications__value-title">Dimensions</p> **<p class="specifications__value-copy">5.38 x 2.75 x 0.31 inches<

Merge XML nodes sharing the same name with “_LIST” in the node name and also at root level

非 Y 不嫁゛ 提交于 2019-12-11 19:15:15
问题 Below is the Input XML and I am looking for the desired output - <xml> <a> <element0>987</element0> </a> <a> <a_list_one> <a_lag_one> <element1>123</element1> <element2>456</element2> </a_lag_one> </a_list_one> <a_list_one> <a_lag_one> <element1>789</element1> <element2>678</element2> </a_lag_one> </a_list_one> <a_list_two> <a_lag_two> <a_list_three> <a_lag_three> <element3>570</element3> <element4>678</element4> </a_lag_three> </a_list_three> <a_list_three> <a_lag_three> <element3>989<

split nodes and assign them to variables for matching

柔情痞子 提交于 2019-12-11 18:53:23
问题 This question is similar to merge two elements using xslt based on attribute values but trying to put this in different way where it could understand better. I have an xml file with two elements whose names are same, but second element is part of first element. Example: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!-- This is first element--> <book> <mbean code="org.book.mybooks" name="mycompany.props.jndi:name=mybookprops"> <attribute name="bookprops"> abc.mybook.onebook=@Value@

How to get all the IDs from two XML and merge to a single XML using XSL

只谈情不闲聊 提交于 2019-12-11 18:39:02
问题 I am trying to compare two responses and find out the same and different IDs from them. After that I need to merge them to a single XML document. Here is one XML document, which is saved in some variable called $one: <test> <console> <consoles> <ID>123</ID> </consoles> <consoles> <ID>122</ID> </consoles> <consoles> <ID>134</ID> </consoles> </console> </test> Here is the other XML document, which is saved in some variable called $two: <test> <console> <consoles> <ID>123</ID> </consoles>