xslt-1.0

XML to CSV using XSLT

本小妞迷上赌 提交于 2020-01-01 22:28:25
问题 XML IS: <projects> <project> <name ID="A" StartDate='2012-01-01' EndDate='2012-01-30'>Shockwave</name> <language>Ruby</language> <Manager ID="M1">Nathan</Manager> </project> <project> <name ID="B" StartDate='2012-01-01' EndDate='2012-02-30'>Other</name> <language>Erlang</language> <Manager ID="M2">Kristi</Manager> </project> </projects> I want to copy this XML to CSV using XSLT. There are 1000 such projects. How can I get the output Shown below into a csv: A;2012-01-01;2012-01-30;Shockwave

XSLT - build multiple (n) html tables of equal size (in this case, 3x3)

邮差的信 提交于 2020-01-01 19:57:50
问题 Reference Question 1 Reference Question 2 Ok, both of the preceding links go to discussions of how to build cells and rows within tables. I was hoping to find an expanded example that showed how to build multiple TABLES of N-cells each (in this case 9 cells each - 3x3). I have been trying for a while to use the logic from the two examples and about 500 other places on the web but haven't been able to crack the nut. Can someone, perhaps the contributor to the above links, shed some light on

fixed: Multiple page-sequence objects

自闭症网瘾萝莉.ら 提交于 2020-01-01 19:27:01
问题 When working with big xml files fop breaks down due to the lack of ram(1.7gb in my case, is the limit), so one of the ways to fix this is to use multiple page sequence objects as described here . However the are no description how to use them... And what I tried to do is to "create" a new page sequence objects using for-each, but it seems that I have failed and fob breaks down when it reaches 1.7gb of ram anyways <xsl:template match="OurForm"> <fo:root xmlns:fo="http://www.w3.org/1999/XSL

How do you add an image?

不羁岁月 提交于 2020-01-01 02:08:09
问题 Situation: I have a simple XML document that contains image information. I need to transform it into HTML . However, I can't see where the open tag is and when I use the XSL code below, it shows the following error message: "Cannot write an attribute node when no element start tag is open." XML content: <root> <HeaderText> <HeaderText>Dan Testing</HeaderText> </HeaderText> <Image> <img width="100" height="100" alt="FPO lady" src="/uploadedImages/temp_photo_small.jpg"/> </Image> <BodyText> <p

Storing html tags within an xsl variable

可紊 提交于 2019-12-31 04:40:44
问题 Sorry if this is a dumb question, but it is possible to store, and retrieve, a HTML snippet within an xsl 1.0 variable? EG: <xsl:variable name="something"><p>Hi there</p><p>How are you today?</p></xsl:variable> <xsl:value-of disable-output-escaping="yes" select="$something"/> It just when I try, it seems to strip the HTML tags out. Thanks. 回答1: You need to use <xsl:copy-of select="$something"/> instead of xsl:value-of . 回答2: I'll add some explanation of what's happening :) The reason you're

Merge different products belong to each standard

家住魔仙堡 提交于 2019-12-31 04:13:18
问题 I have to transform the following xml content, <Standards xmlns="http://ws.wso2.org/dataservice"> <Standard> <ProductID>200057</ProductID> <Prefix>ISO</Prefix> <SNumber>1001</SNumber> <DraftProducts> <RelatedProduct> <ProductID>1500163</ProductID> </RelatedProduct> </DraftProducts> <ReferenceProducts> <RelatedProduct> <ProductID>263973</ProductID> <RelationId>708519</RelationId> <Designation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/> </RelatedProduct>

How to use attribute values from another XML file as an element value selection in the current XML

与世无争的帅哥 提交于 2019-12-30 13:21:48
问题 I have two XML files. One is the main XML file and the other one is used as a lookup table. Here is the main XML: <Report> <row> <field1>test1</field1> <field2>test2</field2> <field3>test3</field3> </row> <row> <field1>test4</field1> <field2>test5</field2> <field3>test6</field3> </row> </Report> The lookup xml file looks like this: <lookup> <fieldmapping name="field1">fieldA</fieldmapping> <fieldmapping name="field2">fieldB</fieldmapping> <fieldmapping name="field3">fieldC</fieldmapping> <

(xslt 1.0) How to replace the space with some string from all the text values in xml?

霸气de小男生 提交于 2019-12-30 10:39:11
问题 EDIT: [it started with character replacement and I ended up with discovering string replacements with help of Dimitre Novatchev and Roland Bouman I think the sample codes are sufficient to explain the requirements .. This is the sample XML: <root> <node1>text node</node1> <node2>space between the text</node2> <node3> has to be replaced with $</node3> </root> This is the Output I am expecting: <root> <node1>text$node</node1> <node2>space$between$the$text</node2> <node3>$has$to$be$replaced$with

Formatting string (Removing leading zeros)

北城以北 提交于 2019-12-30 08:00:28
问题 I am newbie to xslt. My requirement is to transform xml file into text file as per the business specifications. I am facing an issue with one of the string formatting issue. Please help me out if you have any idea. Here is the part of input xml data: "0001295" Expected result to print into text file: 1295 My main issue is to remove leading Zeros. Please share if you have any logic/function. 回答1: Just use this simple expression : number(.) Here is a complete example : <xsl:stylesheet version=

How do I replace sequences of whitespaces by one space but don't trim in XSLT?

亡梦爱人 提交于 2019-12-30 05:05:40
问题 The function normalize-space removes leading and trailing whitespace and replaces sequences of whitespace characters by a single space. How can I only replaces sequences of whitespace characters by a single space in XSLT 1.0? For instance "..x.y...\n\t..z." (spaces replaced by a dot for readability) should become ".x.y.z." . 回答1: Without Becker's method, you could use some discouraged character as mark: translate(normalize-space(concat('&#x7F;',.,'&#x7F;')),'&#x7F;','') Note : Three function