xslt

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=

Remove all nodes from xml excluding specific nodes using XSLT

泄露秘密 提交于 2020-01-13 05:51:52
问题 I have a bunch of xml files with a varying amount of data nodes in them and I want to change the files using XSLT to include only specific nodes. Example: <?xml version="1.0" encoding="UTF-8"?> <SomeName> <identifier> <UID> 1234 </UID> </identifier> <MainNode1> <SubNode1> <Subnode1a>DATA1a0</Subnode1a> </SubNode1> <SubNode1> <Subnode1a>DATA1a1</Subnode1a> </SubNode1> <SubNode1> <Subnode1a>DATA1a2</Subnode1a> </SubNode1> </MainNode1> <MainNode2> <SubNode2> <Subnode2a>DATA2a0</Subnode2a> <

Create SVG bar charts from XML with XSLT

放肆的年华 提交于 2020-01-13 05:49:10
问题 I'm using XSLT to transform XML to SVG. I want to create horizontal bar charts with one value to left and the bar chart value to the right. The XML looks like this: <value1 name="something"> <value2>13</value2> </value1> <value1 name="something else"> <value2>45</value2> </value1> And this is what I got so far, creating horizontal bar charts from value2. <xsl:template match="/" mode="svg"> <svg width="500px" height="500px" xmlns="http://www.w3.org/2000/svg"> <g id="bar" transform="translate

Convert XML using XSLT in R

心已入冬 提交于 2020-01-13 05:27:12
问题 I have task currently being performed by SQL Server Reporting Services where it exports a dataset to an XML format using an XSLT that converts the typical schema to a bespoke one. In order to replace this report, I need to be able to similarly transform XML when the user wants to download it. The end layout produced by XSLT is horrible - it involves padding and all sorts of whacky concatenations and I'd rather not reinvent the wheel by doing the whole transformation in the first conversion

How to embed external pdf/txt file into another using XSL-FO?

大兔子大兔子 提交于 2020-01-13 02:47:09
问题 Is it possible to embed an external PDF or TEXT document into a master PDF by using XSL-FO/XSLT? I have xslt stylesheet to produce PDF documents. But, the input XML contains inlined TEXT or Base64 encoded PDF documents. So what I do in my HTML version of my stylesheet I extract the TEXT or PDF and dump it on disk. Then in the xslt I have this: <xsl:when test='(n1:text/@mediaType="application/pdf") or (n1:text/@representation="B64")'> <IFRAME name='documentFrame' id='documentFrame' WIDTH='100%

What's the non-deprecated alternative to XmlDataDocument and XslTransform?

不羁的心 提交于 2020-01-12 15:52:36
问题 I am modifying some legacy code to try to eliminate warnings. XmlDataDocument and XslTransform both generate warnings that they are obsolete. In the case of XslTransform the suggested replacement is XslCompiledTransform , but no replacement is suggested for XmlDataDocument . How can I change this code to eliminate warnings in .NET 4: var xmlDoc = new System.Xml.XmlDataDocument(myDataSet); var xslTran = new System.Xml.Xsl.XslTransform(); xslTran.Load(new XmlTextReader(myMemoryStream), null,

What's the non-deprecated alternative to XmlDataDocument and XslTransform?

走远了吗. 提交于 2020-01-12 15:52:05
问题 I am modifying some legacy code to try to eliminate warnings. XmlDataDocument and XslTransform both generate warnings that they are obsolete. In the case of XslTransform the suggested replacement is XslCompiledTransform , but no replacement is suggested for XmlDataDocument . How can I change this code to eliminate warnings in .NET 4: var xmlDoc = new System.Xml.XmlDataDocument(myDataSet); var xslTran = new System.Xml.Xsl.XslTransform(); xslTran.Load(new XmlTextReader(myMemoryStream), null,

Bypassing namespaces while copying an XML with XSLT

旧城冷巷雨未停 提交于 2020-01-12 05:57:51
问题 Starting from an XML with a default namespace: <Root> <A>foo</A> <B></B> <C>bar</C> </Root> I apply an XSLT to remove the 'C' element: <?xml version="1.0" ?> <xsl:stylesheet version="2.0" xmlns="http://www.w3.org/1999/XSL/Transform" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" indent="no" encoding="utf-8" /> <xsl:template match="*"> <xsl:copy> <xsl:copy-of select="@*" /> <xsl:apply-templates /> </xsl:copy> </xsl:template> <xsl:template match="C" /> </xsl

Xslt how to style conditional odd/even rows

﹥>﹥吖頭↗ 提交于 2020-01-12 05:24:05
问题 I've an html table written using xslt transformation that looks like this <table> <xsl:for-each select="someNode"> <xsl:if test="testThis"> <tr> <!-- <xsl:call-template name="conditionalRowStyle"/> --> <td>something</td> </tr> </xsl:if> <tr> <!-- <xsl:call-template name="conditionalRowStyle"/> --> <td>this is always displayed</td> </tr> <xsl:if test="testThis2"> <tr> <!-- <xsl:call-template name="conditionalRowStyle"/> --> <td>something 2</td> </tr> </xsl:if> .... </xsl:for-each> <tr> <!--

xpath select by attribute when attribute not present

↘锁芯ラ 提交于 2020-01-11 16:36:47
问题 Short question: I would like to select all nodes that do not match an attribute (@type !='x') but also attribute doesn't exist (??). Currently, I'm getting nothing back, because the other nodes have no attribute at all. Background: I have some XML. Note that one has type="feature" but all others have no 'type' attr. <image type="feature"><description>X</description><url>media/designer_glass_tile_04.jpg</url><height></height><width/></image> <image><description>Designer Glass 05</description>