xslt-1.0

Adding common attribute to all chains in recursion

放肆的年华 提交于 2021-02-11 14:53:15
问题 A follow-up question to: Limit recursion with one deepest loop and assign exact id to all elements This code collects recursion. It is necessary that at the same time all recursion elements receive a COMMON-ID attribute with the value from the first element of the chain. This first element has also an attribue STATUS="0" . Other elements have STATUS="1" (for solution it may be useful). 1-source <root> <object id="a" id-3="COMMON-ID-1" STATUS="0"/> <object id="b" id-3="COMMON-ID-2" STATUS="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

I want to convert XPath value like Z.12.s from Z12s using xslt

那年仲夏 提交于 2021-02-05 12:19:55
问题 Please any one help me on converting XPath value to dot (full stop) separated. E.g: Z12s to Z. 12.after 1st char need put dot and after 2 char dot then every 2 chars dot but not last value. 回答1: If you don't know the length of the input string, you will need to use a recursive named template for this, such as: <xsl:template name="split-string"> <xsl:param name="string"/> <xsl:param name="length" select="1"/> <xsl:value-of select="substring($string, 1, $length)"/> <xsl:if test="string-length(

I want to convert XPath value like Z.12.s from Z12s using xslt

馋奶兔 提交于 2021-02-05 12:16:35
问题 Please any one help me on converting XPath value to dot (full stop) separated. E.g: Z12s to Z. 12.after 1st char need put dot and after 2 char dot then every 2 chars dot but not last value. 回答1: If you don't know the length of the input string, you will need to use a recursive named template for this, such as: <xsl:template name="split-string"> <xsl:param name="string"/> <xsl:param name="length" select="1"/> <xsl:value-of select="substring($string, 1, $length)"/> <xsl:if test="string-length(

(Recursion) auto-incrementation for all depth level elements and keeping heredity path in chain

旧街凉风 提交于 2021-02-05 09:53:30
问题 Is it possible to make unique id (here as an attribute "path"'s value) by implementing incremental principle? for 3 lvl depth recursion, for example it would look like "1/1/1" or "1/1/2" - if there is a sibling on a third level I may admit that from technical point of XSLT realization it would be useful to use level prefix before +1 increment counting. That case also would be correct. the main thing - to assembly unique id ("path") 1-source <root> <object id="a" id-3="value"/> <object id="b"

(Recursion) auto-incrementation for all depth level elements and keeping heredity path in chain

穿精又带淫゛_ 提交于 2021-02-05 09:53:21
问题 Is it possible to make unique id (here as an attribute "path"'s value) by implementing incremental principle? for 3 lvl depth recursion, for example it would look like "1/1/1" or "1/1/2" - if there is a sibling on a third level I may admit that from technical point of XSLT realization it would be useful to use level prefix before +1 increment counting. That case also would be correct. the main thing - to assembly unique id ("path") 1-source <root> <object id="a" id-3="value"/> <object id="b"

XSLT Muenchian grouping create key inside group

喜欢而已 提交于 2021-02-05 09:40:46
问题 My goal is to group the nodes first by <RowBreak> , then in each <RowBreak> group, I want to group by <ColumnBreak> . Here is my XML. <?xml version="1.0" encoding="utf-8" ?> <Tree> <Item> <Label>Item 1</Label> </Item> <Item> <Label>Item 2</Label> </Item> <ColumnBreak /> <Item> <Label>Item 3</Label> </Item> <Item> <Label>Item 4</Label> </Item> <Item> <Label>Item 5</Label> </Item> <RowBreak /> <Item> <Label>Item 6</Label> </Item> <Item> <Label>Item 7</Label> </Item> <ColumnBreak /> <Item>

XSLT Muenchian grouping create key inside group

£可爱£侵袭症+ 提交于 2021-02-05 09:39:16
问题 My goal is to group the nodes first by <RowBreak> , then in each <RowBreak> group, I want to group by <ColumnBreak> . Here is my XML. <?xml version="1.0" encoding="utf-8" ?> <Tree> <Item> <Label>Item 1</Label> </Item> <Item> <Label>Item 2</Label> </Item> <ColumnBreak /> <Item> <Label>Item 3</Label> </Item> <Item> <Label>Item 4</Label> </Item> <Item> <Label>Item 5</Label> </Item> <RowBreak /> <Item> <Label>Item 6</Label> </Item> <Item> <Label>Item 7</Label> </Item> <ColumnBreak /> <Item>

XSLT 1.0 - Output Count of Value Uniqueness in a Node with Vanilla XSLT 1.0 or PHP XSLT

寵の児 提交于 2021-01-29 12:54:52
问题 I have a node in my XML data named this node contains a unique value, say 45678. Via XSLT, I'd like to only include this node's data, if 45678 is found more than once (1) in the complete data set. The end result can modify the existing node, or create a new one called . The end result of this data creates "Parent with children" products. The productId value groups all similar products together, the problem, is that sometimes there is only 1 product with that key, and I shouldn't create a