xslt

Compare date between two dates using XSLT

拟墨画扇 提交于 2020-01-15 03:08:08
问题 this is my xml <?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/xsl" href="test.xsl"?> <products> <product_id value=" 1 "> <tab_id value=" 51 "> <tab_name value=" test1 "/> <status value=" 2 "/> <log value=" 5748 , 5749 , 128 "/> <born_from value=" 1980-08-01 , 1989-02-01 "/> <born_to value=" 1985-08-01 , 1998-02-01 "/> <sex value=" 2 , 1 "/> <link value=" www.google.com "/> </tab_id> </product_id> <product_id value=" 2 "> <tab_id value=" 52 "> <tab_name value=" test2 "

How to traverse a nested XML structure using templates

风流意气都作罢 提交于 2020-01-14 16:36:03
问题 I am new to XSL and in the process of picking this up from scratch to solve a problem. I have a source XML file that contains the following structure:- <root> <Header> </Header> <DetailRecord> <CustomerNumber>1</CustomerNumber> <DetailSubRecord> <Address>London</Address> </DetailSubRecord> <DetailSubRecord> <Address>Hull</Address> </DetailSubRecord> </DetailRecord> <DetailRecord> <CustomerNumber>2</CustomerNumber> <DetailSubRecord> <Address>Birmingham</Address> </DetailSubRecord>

How to replace multiple text substrings in XSLT 1

廉价感情. 提交于 2020-01-14 12:55:28
问题 With XSLT 1.0, the regex methods of XSLT 2.0 are generally unavailable. Is there any non-regex way of replacing multiple fields in a node in a source xml document, for example to convert: <?xml version="1.0" encoding="utf-8"?> <xliff xmlns:xliff="urn:oasis:names:tc:xliff:document:1.1" version="1.1"> <file> <source>abc [[field1]] def [[field2]] ghi</source> </file> </xliff> to: <?xml version="1.0" encoding="utf-8"?> <xliff xmlns:xliff="urn:oasis:names:tc:xliff:document:1.1" version="1.1">

Do XPath axes respect Xslt sorting?

孤人 提交于 2020-01-14 10:23:18
问题 If I call an xslt template like so: <xsl:template match="hist:Steps"> <dgml:Links> <xsl:apply-templates select="hist:Step"> <xsl:sort data-type="text" select="hist:End" order="ascending"/> </xsl:apply-templates> </dgml:Links> </xsl:template> Will the following-sibling axis in the template below interrogate the document order or the sorted order? <xsl:template match="hist:Step"> <xsl:if test="following-sibling::hist:Step"> <dgml:Link> <xsl:attribute name="Source"> <xsl:value-of select="hist

XSLT2.0 processor for Perl?

老子叫甜甜 提交于 2020-01-14 09:31:26
问题 Is there any robust XSLT2.0 processor for Perl? I just tried out XML::LibXSLT and it doesn't support analyze-string, regex, etc. I'm afraid of using XML::Saxon::XSLT2 for my work cause it uses Java and I wouldn't want to add that to my list of dependencies. What library do you guys use for XSL2.0 transformations? Cheers, 回答1: So you're looking for an XSLT 2.0 processor written in Perl? No, you most definitely do not want a pure-Perl XSLT processor. The result would be excruciatingly slow and

XSLT Format Date

回眸只為那壹抹淺笑 提交于 2020-01-14 09:21:08
问题 I have a date in this format 10/12/2011 12:55:00 PM (MM-DD-YYYY time) I would like to format this date into 12/10/2011 (DD-MM-YYYY) time to be removed using XSLT? the complexity I find is sometimes the input date can look like 7/12/2011 12:55:00 PM (only one number to the front instead of 07) Can someone please show me a way to implement this? many thanks in advance. 回答1: It is easy to obtain desired result using only standard XPath string functions like substring-before , substring-after and

Context before and after a word (xslt)

让人想犯罪 __ 提交于 2020-01-14 06:18:26
问题 <block> <p>(...) nogen Forundring, med dyb Bedrøvelse, men <seg>end</seg> dybere Rolighed, læsde jeg Baggesens Svar til mig i Skilderiet No. 9 (...)</p> </block> I am all new when it comes to xslt. How do I pick the context, say three words before and after, the content tagged with the element ? I have been trying whit string-before and string-after but whit no success at all. The result should look like this: word: end context: dyb Bedrøvelse, men end dybere Rolighed, læsde 回答1: We do not

Remove embedded html tags with xslt

不羁岁月 提交于 2020-01-14 06:12:27
问题 My input xml has embedded html tags in Emp_Name and Country Elements and I need to strip off only html tags to get the below desired output. Could you please assist how this can be achieved in XSLT. Input XML: <root> <Record> <Emp_ID>288237</Emp_ID> <Emp_Name> <br>John</br></Emp_Name> <Country><p>US</p></Country> <Manager>Wills</Manager> <Join_Date>5/12/2014</Join_Date> <Experience>9 years</Experience> <Project>abc</Project> <Skill>java</Skill> </Record> Desired Output: <root> <Record> <Emp

xsl - tag position with text mixed in parent

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-14 04:31:12
问题 In XSL 1.0, I am trying to distinguish between the following 2 scenarios which both occur within the input XML I need to process and each to be handled differently. Scenario 1 <tag1><tag2/> some text</tag1> Scenario 2 <tag1>some text <tag2/></tag1> I have a template which matches at the <tag2/> level, within this I want scenario 1 to ignore <tag2/> , in scenario 2 I want to insert a <br/> in place of <tag2/> . I have searched on here and on google but can't seem to figure out how to

XSLT Split comma separated file

喜夏-厌秋 提交于 2020-01-14 04:31:08
问题 I have some data in an XML element that looks like this: <?xml version="1.0" encoding="UTF-8"?> <payload> <set> <month>JAN,FEB,MAR</month> <season>Season1</season> <productId>ABCD</productId> </set> </payload> The thing i am interested in is to split the comma seperated string into whole new set tags like: <payload> <set> <month>JAN</month> <season>Season1</season> <productId>ABCD</productId> </set> </payload> <payload> <set> <month>FEB</month> <season>Season1</season> <productId>ABCD<