xslt

XSL Merging Multiple XML Records in the Same File

一个人想着一个人 提交于 2021-02-11 13:53:08
问题 I have a single XML file containing multiple records. Each record has a key. I'd like to select all of the records by key and collapse each into one XML record. Some of the data in each XML record is repeated and there are empty elements. I'd also like to remove duplicates and empty tags. Input <Data> <Record> <Key>12345</Key> <Number>09095I</Number> <Text_Field_1>Record 1: This is Text Field 1</Text_Field_1> <Text_Field_2>This is Text Field 2</Text_Field_2> <Author>A1</Author> <Author>A2<

xsl:result-document instruction throws error when invoking stylesheet with Calabash

丶灬走出姿态 提交于 2021-02-11 12:50:09
问题 I have an XSL stylesheet that looks like this: <xsl:template name="xsl:initial-template"> <xsl:for-each-group select="collection($doc-collection)//dr:description" group-by="format-date(dr:date, '[Mn]-[Y]')"> <xsl:result-document href="{current-grouping-key()}.html" method="html" indent="yes"> <xsl:call-template name="page"> <xsl:with-param name="desc" select="current-group()"/> </xsl:call-template> </xsl:result-document> </xsl:for-each-group> </xsl:template> (Variables and other templates

Distinguish between odd and even page in xsl

≡放荡痞女 提交于 2021-02-11 12:34:57
问题 I have some table in my document and I want different margins for odd and even pages, so how can I distinguish a page is odd/even using when condition in xsl fo. 回答1: You want: Separate fo:simple-page-master for the odd and even pages An fo:layout-master-set that selects the correct page master for odd and even pages. E.g.: <fo:page-sequence-master master-name="PageMaster"> <fo:repeatable-page-master-alternatives> <fo:conditional-page-master-reference master-reference="OddPage" odd-or-even=

Distinguish between odd and even page in xsl

雨燕双飞 提交于 2021-02-11 12:34:04
问题 I have some table in my document and I want different margins for odd and even pages, so how can I distinguish a page is odd/even using when condition in xsl fo. 回答1: You want: Separate fo:simple-page-master for the odd and even pages An fo:layout-master-set that selects the correct page master for odd and even pages. E.g.: <fo:page-sequence-master master-name="PageMaster"> <fo:repeatable-page-master-alternatives> <fo:conditional-page-master-reference master-reference="OddPage" odd-or-even=

Creating a xslt transformation based based on effective dates and sequence

社会主义新天地 提交于 2021-02-11 12:17:58
问题 I have the following xml file. I need to be able to generate a csv file based on below. However the catch is if its the same effective moment and there are multiple sequence attributes it should generate just one line of output, however if the effective moment (just date part) is different then it should generate a line each based on the effective moment. I have trying to play with xslt but have been struggling so far. Any help provided will be appreciated. XML file <?xml version="1.0"

Creating a xslt transformation based based on effective dates and sequence

孤人 提交于 2021-02-11 12:17:17
问题 I have the following xml file. I need to be able to generate a csv file based on below. However the catch is if its the same effective moment and there are multiple sequence attributes it should generate just one line of output, however if the effective moment (just date part) is different then it should generate a line each based on the effective moment. I have trying to play with xslt but have been struggling so far. Any help provided will be appreciated. XML file <?xml version="1.0"

How to get the number of rows and SUM of the fields after grouping them in XSLT

为君一笑 提交于 2021-02-11 08:42:26
问题 I have an XML that contains workers and amounts. In the output, the file will contain lines for a worker - one line if he has EX and one line if he has ER. He has EX if he has amount1 in the xml file, and ER if he has amount2. This works perfectly fine in the my current XSLT. The main issue is on how to properly get the correct total number of rows and the sum of all amounts (both amount1 and amount2) after grouping them, and should be added in the header. Here's the sample XML: <Report_Data>

How to pick value of multiple nodes and test it in a single condition?

给你一囗甜甜゛ 提交于 2021-02-11 06:51:31
问题 In continuation to this post, I have restructured the code to better understand my requirement. I have also provided more detail to it. XML FILE <Person> <Name>Kavya</Name> <Gift> <ItemName>PD1</ItemName> </Gift> <Gift> <ItemName>PS1</ItemName> </Gift> <Gift> <ItemName>PD2</ItemName> </Gift> </Person> Now, In the above structure, I need to return a text Successfull only when the Person has a Gift with ItemName that is empty or has only PS1 and not PD1 or PD2 . So, when writing an XSLT file, I

Convert XML attributes to elements using XSLT

流过昼夜 提交于 2021-02-10 08:44:47
问题 I am trying to transform input XML documents attributes to elements using the following stylesheet: <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml"/> <xsl:template match="*"> <xsl:element name="{name()}"> <xsl:for-each select="@*[name()!='type']"> <xsl:element name="{name()}"> <xsl:value-of select="."/> </xsl:element> </xsl:for-each> <xsl:apply-templates select="*|text()"/> </xsl:element> </xsl:template> </xsl

Convert XML attributes to elements using XSLT

旧城冷巷雨未停 提交于 2021-02-10 08:44:15
问题 I am trying to transform input XML documents attributes to elements using the following stylesheet: <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml"/> <xsl:template match="*"> <xsl:element name="{name()}"> <xsl:for-each select="@*[name()!='type']"> <xsl:element name="{name()}"> <xsl:value-of select="."/> </xsl:element> </xsl:for-each> <xsl:apply-templates select="*|text()"/> </xsl:element> </xsl:template> </xsl