xslt

Convert XML to HTML Table in XSLT

放肆的年华 提交于 2021-01-29 10:30:58
问题 I'm trying to transform my XML to an HTML table but still quite confused with how to do row-column mapping using templates. My XML definition is: <Table> <Parent> <Head>Header 1</Head> <Children> <Node>Node 1</Node> <Node>Node 2</Node> <Node>Node 3</Node> </Children> </Parent> <Parent> <Head>Header 2</Head> <Children> <Node>Node 4</Node> <Node>Node 5</Node> <Node>Node 6</Node> </Children> </Parent> </Table> Expected HTML output: <table> <tr> <td>Header 1</td> <td>Header 2</td> </tr> <tr> <td

Split large XML to smaller chunks by node count using XSLT

别等时光非礼了梦想. 提交于 2021-01-29 09:01:56
问题 I have a requirement where we are getting a large XML file and I need to transform on small chunks below is the XML sample with 4 records, I have to transform the XML so I am able to group them in chunks of 2. <!-- Original XML--> <EmpDetails> <Records> <EmpID>1</EmpID> <Age>20</Age> </Records> <Records> <EmpID>2</EmpID> <Age>21</Age> </Records> <Records> <EmpID>3</EmpID> <Age>22</Age> </Records> <Records> <EmpID>4</EmpID> <Age>23</Age> </Records> </EmpDetails> <!-- Expected XML-->

Using XSL:sort within xsl:if

此生再无相见时 提交于 2021-01-29 08:32:50
问题 I'm just figuring out how XSL works... mostly. I have 3 nodes (STUX, KbnApp, KbnStorge) that I want to transform in the same way except for how their list of "Servers" children are sorted. I wanted to do this with a single template that uses an xsl:if to choose an alternate sorting method for the "STUX". But I couldn't get it to work. The STUX Servers should end up in descending order, the others should stay in whatever order they are currently in. Here is my XML <?xml version="1.0" encoding=

Remove values from rows under specific columns in csv file

天大地大妈咪最大 提交于 2021-01-29 08:30:54
问题 I'm currently trying to remove specific values from rows under specific columns in a CSV-file. Whats the best way of doing this? Is it to use a XSLT map file in the code or doing this only by code? (Using c#) What I want to do is this: BEFORE MANIPULATION: id, name, email, phoneNumber, dob 1,John Doe,JohnDoe@mail.com,123456789,1988-08-08 2,Jane Doe,JaneDoe@mail.com,987654321,1987-07-07 AFTER MANIPULATION: id, name, email, phoneNumber, dob 1,John Doe,,,1988-08-08 2,Jane Doe,,,1987-07-07 As you

Adding a parent to selected siblings using XSLT

不问归期 提交于 2021-01-29 08:00:55
问题 I am new to XSLT have a XML that looks like this: <?xml version="1.0" encoding="UTF-8"?> <FileHeaderRecord> <FormatCode>1</FormatCode> <ImmediateDestinationName>MEPS</ImmediateDestinationName <CompanyBatchHeader> <OriginatorStatusCode>1</OriginatorStatusCode> <OriginatingFIIdentification>10000214</OriginatingFIIdentification> <BatchNumber>0000004</BatchNumber> <recordvalues>22100002225201198876900</recordvalues> <ammendvalues>23</ammendvalues> <ammendvalues>23439358</ammendvalues>

How to I add offset to datetime in XSLT?

帅比萌擦擦* 提交于 2021-01-29 07:22:04
问题 I want to add whatever's in the offset the variable originalDate parameter passed to DAYFORMAT template. Here's the XML: <StartDate xmlns:b="http://schemas.datacontract.org/2004/07/System"> <b:DateTime>2020-10-27T23:00:00Z</b:DateTime> <b:OffsetMinutes>60</b:OffsetMinutes> </StartDate> This is my code which formats the date but I'm not sure how I can add offset minutes to the DateTime? <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

XLS Transformation from XML in particular table order

浪子不回头ぞ 提交于 2021-01-29 07:16:55
问题 I have the XML file below for which I'm trying to create a XSLT template to tabulate some nodes. May someone could help me out please. <Main> <Document>Doc.1</Document> <Cini>DDFR</Cini> <List> <SubList> <CdTa>ABC</CdTa> <NN>XYZ</NN> <ND> <RiS> <RiN> <NSE14> <MNRs> <MRD> <NR> <N1>393</N1> <N2>720</N2> <SNR> <NR_i>203</NR_i> <NR_f>49994</NR_f> </SNR> </NR> </MRD> <MRD> <NR> <N1>687</N1> <N2>345</N2> <SNR> <NR_i>55005</NR_i> <NR_f>1229996</NR_f> </SNR> </NR> </MRD> </MNRs> <GNRs> <RD> <NR> <N1

Wrapping all nodes in between 2 Processing Instructions with XSLT

ぐ巨炮叔叔 提交于 2021-01-29 07:16:51
问题 Input XML: <content> <p> <?start?> test <em> test man </em> <strong>test man</strong> <?end?> do not grab this text <strong>or this text</strong> </p> </content> Desired output XML: <content> <p> <ins> test <em> test man </em> <strong>test man</strong> </ins> do not grab this text <strong>or this text</strong> </p> </content> I'm trying to wrap all text nodes and nodes in between the two processing instructions in a tag. Is there any way to achieve this with XSLT 2.0? My current template that

XML/ XSL Transformation issue in C# routine to output HTML with embedded CSS content

情到浓时终转凉″ 提交于 2021-01-29 07:03:13
问题 I have a XSL script that has this towards the top: <head> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <xsl:choose> <xsl:when test="$CSSFile1 !=''"> <style type="text/css"> <xsl:value-of select="$CSSFile1"/> </style> </xsl:when> <xsl:otherwise> <link rel="stylesheet" type="text/css" href="Workbook-S-140-PublicTalk-WatchtowerStudy-ServiceTalk-Videoconference2.css"/> <link rel="stylesheet" type="text/css" href=

Remove a tag using XSLT

佐手、 提交于 2021-01-29 06:59:53
问题 I am filtering an XML document that has the following structure: <?xml version="1.0" encoding="UTF-8"?> <root> <channel> <item> <title>My Second Great Title</title> <link>http://server.com/content/my-second-great-title</link> <tag>vuluptate</tag> <tag>id</tag> <tag>cras</tag> <tag>pretium</tag> <tag>conubia</tag> <tag>libero</tag> <description><![CDATA[This is a second great description <img src="http://server.com/images/image01.png" />]]></description> <publishedAt>Sat, 08 Nov 2015 10:00:52