xslt

parsing date and time

Hello All, Currently In my source file, i am getting date and time values like below. 2010-07-06T19:06:47 i want to put date in one variable and time in another one. Please let me know how to do this. Thanks and Regards, Kiran. ...

Count XML nodes using XSLT but excluding certain nodes

I have the following XML: <assessment> <section> <item name="Item1"/> <item name="Item2"/> <item name="Item3"> <attributes> <item_references> <item_reference> <attributes> <item name="Item3.1"> ...

XSLT element names as a string

I want to output something similar to the following using XSLT XML: <myroot> <node1> <subnode1>somestuff</subnode1> <subnode2>otherstuff</subnode2> </node1> <node2> <subnode2></subnode2> <subnode3>stuff here</subnode3> </node2> <node3> <subnode>stuff</subnode> <subnode>stuff</subnode> <subnode>othe...

Concatenate data into one variable

Hello All, Source file looks like below. </StsRsn> <AddtlStsRsnInf>/00000002/Level 2 Reject</AddtlStsRsnInf> <AddtlStsRsnInf>The Transaction Reference Number is</AddtlStsRsnInf> <AddtlStsRsnInf> not unique.</AddtlStsRsnInf> </StsRsnInf> now the requirement is to concatenate the <AddtlStsRsnInf> value into one signle variable. Could...

How do I wrap a set of items within <xml:choose>?

A <div> cannot be a child of <xml:choose>, but I only want <li>s to repeat in other words, not their parent <div>s or <ul>s. Below you'll find my sample input, XSLT, and sample desired output. Input <?xml version="1.0" encoding="utf-8" ?> <Collection> <Content> <Html> <root> <news> ...

Optimize <xsl:choose> with many <xsl:when>

I have a series of medium-sized XML documents, which are mainly text with a few nodes representing macros to be expanded, e.g.: <foo>Some text <macro>A1</macro> ... <macro>B2</macro> ...etc...</foo> My goal is to replace each macro with the corresponding XML. Usually it's a single <img> tag with different attributes, but it could be s...

Creating new elements through text processing in XSLT.

I'm wondering if/how the following can be accomplished in XSLT. If not, what would you use? (I used OmniMark, but I would like to know if this is possible in XSLT.) Here's an example of the input XML: <?xml version="1.0" encoding="UTF-8"?> <fragment> <firstElem> <secondElem>D12</secondElem> </firstElem> <firstElem> ...

Consume Government Webservice

I'm attempting to pull information from the publicly accessible Recreation Information Database. The feed I'm trying to parse through is http://www.recdata.gov/feeds/RecElements/getAllRecElementsForOrgID_-1.xml (large file) It seems that the feed is a complex xml document which looks like it has a lot of references to information simila...

Transforming XML to CSV - details

Hi all, I have some trouble with the correct formulation of a transform. I'm generating CSV files. I can easily generate the following csv: "version","","stuff", "version1version2","annotation1annotation2","yadda", However, I would like for the different instances of subfields to be comma-separated within their string, as fo...

Gobal counter in XSLT or alternative solution?

This is my Source-XML. It is originally a Word-ML which have been reduced to an own structure. Elements with name "aaa" can have any kind of name. The problem is the handling of footnotes: <root> <doc> <comment>text text text <footnote id="1" > text text text</comment> <aaa>text text text</aaa> <aaa>text text text<footnote...

Need to write a XSLT that will transform the XML in below format

Source XML :---I have multiple Owner with same and different value and has different contract number. <?xml version="1.0" standalone="yes"?> <NewDataSet> <Table1> <Owner>1</Owner> <Contract_Number>3</Contract_Number> </Table1> <Table1> <Owner>1</Owner> <Contract_Number>4</Contract_Number> </Table1> ...

xml-fo pdf table : 'colspan' when the number of columns is dynamic

I'm generating a table in a pdf document using xml-fo. The number of columns is dynamic. Columns are only displayed when tests are passing. In tests I'm using variables like $var1, $var2, ... that point to xml nodes. I've something like <xsl:element name="fo:table-row"> <xsl:element name="fo:table-cell" use-attribute-sets="table-...

Using an XSL for-each on identical XML children

In brief, my problem is that I want to loop through the contents of one child among identical children, but when I try to do so, it loops through the contents of all the children, giving me as many duplicates of the data as there are children. Example code: Input.xml <?xml version="1.0"?> <base> <item name="item1"> <foo> ...

Developing XSLT with TDD/BDD

I've been assigned the task of creating an XSLT transform on an XML dump from a database. Being a believer of Test/Behavior Driven Development I was wondering if anyone has attempted it before or has advice about how to go about it. My gut reaction is to test this 'black box' with rspec. Is there a unit testing framework out there f...

Filter XML from searchparameters

Hi there folks! I'm creating a small search function on a site I'm creating. I'm working with Umbraco CMS, and all the nodes that I need to search are children of the page that are being searched on. Right now I have a search box with seven fields. three input fields and four dropdown's. This is the XML that I need to find my results f...

Looping over distinct values

Given a variable which returns a list of distinct States using the distinct-values() function, is there a way to tokenize the variable in a for-each loop? <States> <State>AL</State> <State>AL</State> <State>NM</State> </States> The following variable returns AL and NM, but I can't iterate over it using for-each. Is there a way around...

Umbraco XSLT - Retrieving a nodes 'pageImage' when listing

I've got a news page on my site, which lists all the subpages (news articles) in a macro. Each of the subpages has an image (alias pageImage) I've got the following XSLT code, but It's not working: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]> <xsl:stylesheet version="1.0" xml...

what's the best scenario to use XSLT

I am learning xslt, but don't know the best scenarios for use xml + xsl. ...

Xsl transformation question.

Hi, All, Next question: I have "InputDoc" xml document and xslt file in order to transform into other "OutputDoc" xml document. You can find examples xslt and xml documents below. <?xml version="1.0" encoding="UTF-8"?> <InputDoc> <InputCollection> <InputItem> <InputValue>Value_1</InputValue> </InputItem> </InputCollec...

Extract the first letter of every word in sentence and make it into one word via XSLT

Hi everyone :D, I am trying to extract the first letter of every word for a sentence to form an one word via XSLT. Sample Input `ABC HBO ORACLE 123 (Hello Person)` Expected Output: AHO123HP Thanks in advance :). P.S. I am also using the XALAN Processor. ...