xslt

xslt xpath using element values in xpath query

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-17 04:57:05
问题 Is it possible to use the element values in xpath? I have the following xml: <root> <html> <table class=" table search-results-property-table"> .... <tr> <td> <span class="versal">HAS TAXONOMIC LEVEL</span> </td> <td> <ul> <li> <a class="versal" href="../../../agrovoc/en/page/c_11125">genus</a> </li> </ul> </td> </tr> <tr> <td> <span class="versal">IS USED AS</span> </td> <td> <ul> <li> <a class="versal" href="../../../agrovoc/en/page/c_1591">christmas trees</a> </li> <li> <a class="versal"

XSLT 1.0: extract sequential infromation from external document

南笙酒味 提交于 2020-01-17 04:23:08
问题 I am trying to use xslt to perform an xml to xml transform, such that each element is given a GUID, pulled in sequential order from an external xml document. Source xml: <?xml version="1.0"?> <dataSets> <data name="foo"/> <data name="bar"/> ... </dataSets> List of IDs: <?xml version="1.0"?> <ids> <id>some-GUID</id> <id>another-GUID</id> ... </ids> Desired output: <?xml version="1.0"?> <dataSets> <data name="foo" id="some-GUID"/> <data name="bar" id="another-GUID"/> ... </dataSets> But I'm

XSLT: How to compare two xml files and how to get distinct value from it

走远了吗. 提交于 2020-01-17 04:13:11
问题 I have two xml files, i just to get distinct chapter and that needs to displayed on the output file. source XML <xml> <chapter>1 Live animals.</chapter> <chapter>2 Meat and edible meat offal.</chapter> <chapter>3 Fish and crustaceans, molluscs and other aquatic invertebrates.</chapter> <chapter>4 Dairy produce; birds eggs; natural honey; edible products of animal origin, not elsewhere specified or included.</chapter> <chapter>5 Products of animal origin, not elsewhere specified or included.<

how to check repeated elements in as string sequence/array?

*爱你&永不变心* 提交于 2020-01-17 03:57:17
问题 I am using xslt 1.0 stylesheet to worlk on xml file data. I have a variable in xslt which conatins many string separated by white space or new line charater. i.e. the variable is "ServiceList", when I print it using follwong, <xsl:value-of select="$ServiceList"/> It prints following out put hgd.sdf.gsdf sdf.sdh.duyg dsf.sdf.suos jhs.sdu.sdfi hdf.sdi.seij dsf.dsf.diuh edr.sdi.sdhg dfh.dfg.dfg.fdg.idjf kjs.dfh.dfgj djg.dfs.dgji I used follwing code to get each string separately. <xsl:variable

How to get rid of xmlns: - Attributes in XSL transformation

為{幸葍}努か 提交于 2020-01-17 03:53:06
问题 I have an xsl transformation to generate ASP.NET User controls (ascx). My XSL is defined this way: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:asp="System.Web.UI.WebControls" exclude-result-prefixes="asp msxsl" > <xsl:output method="xml" indent="no" omit-xml-declaration="yes" /> So from that exclude-result-prefixes I would assume, that everything with the asp prefix should not add the namespace information,

Adjust an alphabetical index from xml grouping to make columns equal

空扰寡人 提交于 2020-01-17 03:44:10
问题 Here is a scenario where an alphabetical index is created into 3 columns. But, the approach for dividing them into columns has some scope of improvement. Creating alphabetical index with fixed number of columns in XSLT 2.0 In the above scenario, is there a way if the 3 columns can be made as much equal as possible without breaking a letter group. 回答1: I would suggest the following approach: XSLT 2.0 <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output

Converting XML into String (CDATA) in XSLT

不问归期 提交于 2020-01-17 03:18:09
问题 I have been using Altova Map Force to build XSL transformations recently, and I have come across an issue. In order to create a valid XML output file (from an input text file, which was simple enough to build), it needs to contain some xmlns attribute tags. Unfortunately, I cannot find a way to do this validly (modified the output xsd schema def and attribute forcing) within Map Force or my Data Transformation Tool (built by the client I am building this for, based on Saxon). So, my solution

Need help to convert following html to csv with meta tags of html

淺唱寂寞╮ 提交于 2020-01-17 03:04:06
问题 <html> <head> <title>My Headline</title> <meta name="targetUrl" value="xyz.html?sym=abc"/> <meta name="summary" value="A & B"/> </head> <body> abc abc, pqr, xyz, rst tsd, prrrr, qqqqqqq, oooooo, opop opop, rtrttrt rtrtrtrt </body> </html> The body tag should be changed to csv so the output should be like this : abc abc, pqr, xyz, rst tsd, prrrr, qqqqqqq, oooooo, opop opop, rtrttrt rtrtrtrt if i try @Jim's solution parsing exception occurs for meta tags as they have special characters 回答1:

Numbering placeholders sequentially in a node, based on sequence in which they appear in a preceding node

萝らか妹 提交于 2020-01-17 02:43:05
问题 I have the following snippet of XML, which I would like to transform using XSLT: <?xml version="1.0" encoding="utf-8"?> <tmx version="1.4"> <body> <tu> <prop type="x-Context">-2050338055591740051, -2050338055591740051</prop> <prop type="x-Origin">TM</prop> <prop type="x-ConfirmationLevel">Translated</prop> <tuv xml:lang="en-US"> <seg>The text <ph x="0" type="QIAsymphony" /> goes <ph x="0" type="470" /> here <ph x="0" type="471" />.</seg> </tuv> <tuv xml:lang="es-ES"> <seg>El texto <ph x="0"

Increment Variable count in for-each in XSLT 1.0

徘徊边缘 提交于 2020-01-17 01:23:30
问题 I want to Increment variable in for-each loop. Here is my code. <xsl:variable name="i" select="1" /> <xsl:variable name="oddEven" select="1" /> <xsl:for-each select="//ProfileBR"> <xsl:variable name="j" select="$i + 1" /> sharad j :: <xsl:value-of select="$j"></xsl:value-of> <xsl:variable name="iBR" select="substring(//BRValue,$i,1)" /> <xsl:variable name="jBR" select="substring(//BRValue,$j,1)" /> <xsl:if test="$iBR='1' or $jBR='1'"> <xsl:choose> <xsl:when test="$oddEven='1'"> <tr class=