xslt-1.0

Formatting string (Removing leading zeros)

拈花ヽ惹草 提交于 2019-12-01 02:40:24
I am newbie to xslt. My requirement is to transform xml file into text file as per the business specifications. I am facing an issue with one of the string formatting issue. Please help me out if you have any idea. Here is the part of input xml data: "0001295" Expected result to print into text file: 1295 My main issue is to remove leading Zeros. Please share if you have any logic/function. Just use this simple expression : number(.) Here is a complete example : <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text"/> <xsl:template match="t">

Memory efficient XSLT for transforming large XML files

空扰寡人 提交于 2019-11-30 22:54:51
This question is related to a recent answer by michael.hor257k , which is in-turn related to an answer by Dimitre Novatchev . When used the stylesheet in the above mentioned answer(by michael.hor257k ), for a large XML(around 60MB, sample XML is present below) and the transformation was carried out successfully. When tried another stylesheet, a little different from michael.hor257k's, and is intended to group elements(with a child sectPr ) and their following-siblings(until the next following-sibling element with a child sectPr ), recursively(i.e., group the elements to the depth of the input

lower case the first character of a string using only xslt 1.0

我们两清 提交于 2019-11-30 18:18:49
I have seen patterns for translating a string into lower (or upper case) using the translate function for folks stuck using xslt 1.0. Is there a elegant way of just making the first letter of a string lowercase? TestCase => testCase If your string were, for example, in an attribute called name : <xsl:value-of select="concat(translate(substring(@name, 1, 1), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), substring(@name, 2))"/> You should be able to combine substring and concat with translate to do it like so: concat(translate(substring(s,1,1), $smallcase, $uppercase),substring(s

Memory efficient XSLT for transforming large XML files

心已入冬 提交于 2019-11-30 17:28:02
问题 This question is related to a recent answer by michael.hor257k , which is in-turn related to an answer by Dimitre Novatchev . When used the stylesheet in the above mentioned answer(by michael.hor257k ), for a large XML(around 60MB, sample XML is present below) and the transformation was carried out successfully. When tried another stylesheet, a little different from michael.hor257k's, and is intended to group elements(with a child sectPr ) and their following-siblings(until the next following

To compare two elements(string type) in XSLT?

安稳与你 提交于 2019-11-30 17:20:54
i am new to XSLT ,can any one please suggest to me how to compare two elements coming from xml as string their values are: <OU_NAME>Vision Operations</OU_NAME> --XML code <OU_ADDR1>90 Fifth Avenue</OU_ADDR1> --XML code <xsl:choose> <xsl:when test="OU_NAME='OU_ADDR1'"> --comparing two elements coming from XML <!--remove if adrees already contain operating unit name <xsl:value-of select="OU_NAME"/> <fo:block/>--> <xsl:if test="OU_ADDR1 !='' "> <xsl:value-of select="OU_ADDR1"/> <fo:block/> </xsl:if> <xsl:if test="LE_ADDR2 !='' "> <xsl:value-of select="OU_ADDR2"/> <fo:block/> </xsl:if> <xsl:if

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

丶灬走出姿态 提交于 2019-11-30 16:52:19
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> </CreateResult> </CreateResponse> </soap:Body> </soap:Envelope> my xsl <?xml version="1.0" encoding="UTF

List every node in an XML file

谁说胖子不能爱 提交于 2019-11-30 16:14:19
问题 Simple situation... With any random XML file, I want to create a list of every node that it contains, but without any duplicates! So something like: <root name="example"> <child id="1"> <grandchild/> </child> <child id="2"/> <child id="3"/> </root> Is translated to: /root /root/@name /root/child /root/child/@id /root/child/grandchild How to do this, by just using XSLT? 回答1: Just for fun, without extension function. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

List every node in an XML file

廉价感情. 提交于 2019-11-30 15:42:18
Simple situation... With any random XML file, I want to create a list of every node that it contains, but without any duplicates! So something like: <root name="example"> <child id="1"> <grandchild/> </child> <child id="2"/> <child id="3"/> </root> Is translated to: /root /root/@name /root/child /root/child/@id /root/child/grandchild How to do this, by just using XSLT? Just for fun, without extension function. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="text()"/> <xsl:template match="*|@*"> <xsl:param name="pPath"/> <xsl:param name=

How do I replace sequences of whitespaces by one space but don't trim in XSLT?

我的未来我决定 提交于 2019-11-30 14:53:14
The function normalize-space removes leading and trailing whitespace and replaces sequences of whitespace characters by a single space. How can I only replaces sequences of whitespace characters by a single space in XSLT 1.0? For instance "..x.y...\n\t..z." (spaces replaced by a dot for readability) should become ".x.y.z." . Without Becker's method, you could use some discouraged character as mark: translate(normalize-space(concat('&#x7F;',.,'&#x7F;')),'&#x7F;','') Note : Three function calls... Or with any character but repeating some expression: substring( normalize-space(concat('.',.,'.')),

Function that can be use to omit duplicate value on a string

寵の児 提交于 2019-11-30 09:56:54
问题 I would like to ask if there is a function that can be use to to remove a duplicate value inside a string separated by | simplest possible way. I have below example of the string 1111-1|1111-1|1111-3|1111-4|1111-5|1111-3 the output that I'm expecting is: 1111-1|1111-3|1111-4|1111-5 Thanks in advance. 回答1: All presented XSLT 1.0 solutions so far produce the wrong result : 1111-1|1111-4|1111-5|1111-3 whereas the wanted, correct result is : 1111-1|1111-3|1111-4|1111-5 Now, the following