xslt-1.0

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 every nth node with a filter

走远了吗. 提交于 2020-01-13 13:07:14
问题 I'm using XSLT for some output formatting, and I want a wrapper element around every N nodes of the output. I've read xslt - adding </tr><tr> every n node?, but my problem is that the source nodes have to come from a lookup: <xsl:for-each select="key('items-by-product', $productid)"> rather than just a template match. All the examples I've found assume that the nodes you want are all next to each other, and they're just counting siblings. I have a solution that works for me: <xsl:stylesheet

how to merge two nodes having “the same father”, the same method and the same id=0 (using XSLT)?

拜拜、爱过 提交于 2020-01-13 07:22:48
问题 I need to merge the two nodes street as they have the same: father node: city NEW YORK same method: modify same id: 0 Attributes values must be merged (See the output file at the end of this post) Here is the input file: <country> <state id="NEW JERSEY"> <city id="NEW YORK"> <district id="BRONX" method="modify"> <street id="0" method="modify"> <attributes> <temperature>98</temperature> <altitude>1300</altitude> </attributes> </street> <dadada id="99" method="modify" /> <street id="0" method=

How to convert a negative decimal into hexadecimal using xslt 1

我的未来我决定 提交于 2020-01-11 13:47:13
问题 I would like to convert negative and positive decimal into hexadecimal using xslt 1.0. There's already a topic related to this question here but the answer is given using xslt 2.0. I tried to reproduce the template using xslt 1.0 but it always returns an empty value. <xsl:template name="convertDecToHex"> <xsl:param name="pInt" /> <xsl:variable name="vMinusOneHex64"><xsl:number>18446744073709551615</xsl:number></xsl:variable> <xsl:variable name="vCompl"> <xsl:choose> <xsl:when test="$pInt > 0"

How to convert XML to HTML using XSLT in Java

偶尔善良 提交于 2020-01-09 10:49:30
问题 I want to convert XML file into HTML file with help of XSLT. But I am getting an error i.e. javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: Invalid byte 1 of 1-byte UTF-8 sequence. XML file <?xml version="1.0"?> <Company> <Info> <EmpId>1</EmpId> <EmpName>John</EmpName> <Age>25</Age> <Salary>20000</Salary> </Info> <Info> <EmpId>2</EmpId> <EmpName>Tony</EmpName> <Age>27</Age> <Salary>23000</Salary

want to replace " with " from a xml

旧城冷巷雨未停 提交于 2020-01-07 08:25:35
问题 Hi i have applied CDATA to a sectio of nodes in a xml all the < and > are replaced by < and > . I want to replace " with " in addition. what changes do i need to make to the CDATA part to replace " with " 回答1: You don't say clearly what you are doing, so it's hard to answer simply. If what you mean is that you have added a CDATA marked section in an XML document you are feeding to an XSLT stylesheet; the portion of the stylesheet's output which corresponds to the CDATA section in the input

XSLT Move child elements into new parent node

梦想与她 提交于 2020-01-07 04:30:27
问题 I am very new to XSLT and trying to transform this XML: <Company> <Employee> <name>Jane</name> <id>200</id> <title>Dir</title> <name>Joe</name> <id>100</id> <title>Mgr</title> <name>Sue</name> <id>300</id> <title>Analyst</title> </Employee> </Company> To this expected output: <Company> <Employee> <name>Jane</name> <id>200</id> <title>Dir</title> </Employee> <Employee> <name>Joe</name> <id>100</id> <title>Mgr</title> </Employee> <Employee> <name>Sue</name> <id>300</id> <title>Analyst</title> <

How to get row numbers for elements of XML, using XSLT?

梦想与她 提交于 2020-01-07 03:25:08
问题 Input XML: <root> <imageLink> <url colNumber="1">aa</url> <imageTypeCode colNumber="2">PRODUCT_IMAGE</imageTypeCode> <languageCode colNumber="3">en</languageCode> <languageCode colNumber="3">fr</languageCode> </imageLink> <imageLink> <url colNumber="1">bb</url> <imageTypeCode colNumber="2">PRODUCT_IMAGE</imageTypeCode> <languageCode colNumber="3">fr</languageCode> <commTest> <languageCode colNumber="4">fssdr</languageCode> <languageCode colNumber="4">fr</languageCode> <dummy colNumber="5"

Choose text color for outputted html rendered tabular data through xml with xsl as reference

☆樱花仙子☆ 提交于 2020-01-07 03:06:35
问题 <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> <xsl:template match="/"> <html> <head> <style type="text/css"> table {table-layout: fixed; width: 100%;} td {width: 20%; word-wrap: break-word;} </style> </head> <body> <h2>RTCP STUB STATUS</h2> <table border="1"> <tr bgcolor="#9acd32" > <th>Stub Component</th> <th>Stub Name</th> <th>Stub Operation</th> <th>Stub Version</th> <th

Removing duplicate in XSLT for node having multiple value

a 夏天 提交于 2020-01-07 02:22:35
问题 I have a sample XML which has duplicate node. Node 1 and Node3 with below temperature code and both values in FAH and CC are duplicate. All value within row node needs to be checked to checked to termed it as duplicate node <row> <attr name="temperatureCode">STORADE</attr> <attrQualMany name="temperature"> <value qual="FAH">10</value> <value qual="CC">20</value> </attrQualMany> </row> This sample message is <document> <party> <gtin>1000909090</gtin> <pos> <attrGroupMany name=