xslt-1.0

How to insert a missing element or modify an existing element?

£可爱£侵袭症+ 提交于 2019-12-13 03:38:19
问题 I am working on XML & XSLT dynamic value has to generate. My XmL <query> <one>testing1</one> <one>testing1</one> </query> My Output Xml <query> <one>testing1</one> <one>testing1</one> <sample>100</sample> </query> XSLT I need to check(XSL:IF)whether sample element is available or not from Input XML if available 10% I have to remove % using XSLT then output will be 10. If there Is no element in XML(Sample) It has to create by default 100. Can we able to do this in XSLT is that possible. Can

Grouping based on condition in xsl 1.0

*爱你&永不变心* 提交于 2019-12-13 03:19:27
问题 I need to group based on OperationID and then again group based on COMBINATION_CODE within the OperationID. But COMBINATION_CODE may also have empty tag. The below style sheet is grouping COMBINATION_CODE as expected only if the value is present in COMBINATION_CODE. If empty tag is present, irrespective of OperationID, it is grouping all the empty COMBINATION_CODE records together. Please find the sample input: <root> <records> <record> <OperationID>13</OperationID> <COMBINATION_CODE>c<

XSLT: Convert Name/Value pair and transform an XML

ε祈祈猫儿з 提交于 2019-12-13 03:14:51
问题 I need to convert a name value pair into XML. I'm able to generate an XML, but the element name should be grouped and it should not be duplicated. Please see below. The FieldValue element contains 2 OrderItem values in the Detail node. If the FieldValue with OrderItem repeats, then the result should be grouped into one OrderItem node. Please help. Source XML: <SC> <Header> <Record> <FieldName>Schema</FieldName> <FieldValue>OrderHeader</FieldValue> </Record> <Record> <FieldName>Order<

Need help in XSLT for timezone conversion

依然范特西╮ 提交于 2019-12-13 02:14:44
问题 This is my XML data i need to change the time zone into indian time through XSLT 2016-05-31T16:45:37.556Z Kindly help on this Regards, Siva 回答1: Try: <xsl:template name="UTC-to-Indian"> <xsl:param name="dateTime"/> <xsl:variable name="date" select="substring-before($dateTime, 'T')" /> <xsl:variable name="time" select="substring-before(substring-after($dateTime, 'T'), 'Z')" /> <xsl:variable name="year" select="substring($date, 1, 4)" /> <xsl:variable name="month" select="substring($date, 6, 2)

How to fix 'Errors were reported during stylesheet compilation' in XSLT?

故事扮演 提交于 2019-12-13 00:55:25
问题 I have this SaxonApiException when I run my XSLT code on https://xslttest.appspot.com/. It return this error : net.sf.saxon.s9api.SaxonApiException: Errors were reported during stylesheet compilation I tried on another online tester https://www.freeformatter.com/xsl-transformer.html but I got the same error. I tried to split my XSLT code. First part with the process of extract ZipCode in Wages and second part with the process of extract ZipCode in Addresses. Both works when they're separated

Sorting in xslt and choosing minimum or maximum value

纵饮孤独 提交于 2019-12-13 00:43:03
问题 Need some help in sorting and then choosing either maximum or minimum value in XSLT. Source xml: <target> <relatedTarget> <permitExpiry>2005-07-02T08:11:00.000Z</permitExpiry> <permitStart>2015-07-11T09:22:00.000Z</permitStart> </relatedTarget> <relatedTarget> <permitExpiry>2003-07-12T08:11:00.000Z</permitExpiry> <permitStart>2014-07-01T09:22:00.000Z</permitStart> </relatedTarget> <relatedTarget> <permitExpiry>2002-07-10T08:11:00.000Z</permitExpiry> <permitStart>2016-07-06T09:22:00.000Z<

XSLT - Creating Dynamic Grid with single XML

旧街凉风 提交于 2019-12-12 21:44:48
问题 I am creating dynamic table(grid) using xslt, I am beginner in XSLT, I have also asked question before here it is XSLT - Creating Dynamic Grid please refer it, On Above Question I am using 2 XML for Columns And Rows , But Here i am trying only one XML(Rows). You can find XSLT on above Question with 2 XML Section. XML Data : <TableData> <Rows> <Row ID="0" Name="A" Link-Name="Yes" Hide-ID="Yes" Sort-Name="Yes"/> <Row ID="1" Name="B" Desc="Some description" Link-Name="Yes" Hide-ID="Yes" Sort

How to select the first preceding-sibling which has a particular node as child?

淺唱寂寞╮ 提交于 2019-12-12 18:33:29
问题 I have been trying to write a XPath statement which will select the first preceding-sibling of a node. That sibling should have a particular node as its child. For example: <a> <c></c> .... <b></b> </a> <a></a> .... .... <a></a> <a> <b> start </b> </a> In the above XML, if my context is at the node a which has start text inside its child b . How can I select the preceding node a whose child is b ? I tried preceding-sibling::*[b][1] but it only selects the node a if b is its first child. I

How to format DATE in XSLT 1.0

故事扮演 提交于 2019-12-12 17:42:12
问题 I searched a bit but couldn't find the answer. I want to get current date and format to YYYYMMDD I cannot use EXSLT as per my requirements. 回答1: A very simple Inline C# Script Functoid could look like this: public string MyDateFormat(string dateValue) { string result = String.Empty; string outputFormat = "{0:yyyyMMdd}"; DateTime parsed; if (DateTime.TryParse(dateValue, out parsed)) { result = String.Format(outputFormat, parsed); } else { result = String.Format(outputFormat, DateTime.MinValue)

Converting epoch to date & time with time zone in xslt 2.0

南笙酒味 提交于 2019-12-12 15:35:03
问题 How do I convert epoch time to date & time based on time zone in xslt 2.0 ? For example, epoch time 1212497304 converts to GMT: Tue, 03 Jun 2008 12:48:24 GMT time zone: martes, 03 de junio de 2008 14:48:24 GMT+2 This is because of the Daylight Saving Time (DST): in many countries there is one hour more in summer, during some dates that varies each year. For example, it is supposed that this instruction: <xsl:value-of select=" format-dateTime(xs:dateTime('2013-07-07T23:08:00+00:00'), '[D] [MNn