Questions tagged [xslt]

XSLT is a transformation language for XML. Its primary function is to transform XML documents into different output formats, commonly other XML, HTML or plain text.

Filter by
Sorted by
Tagged with
1 vote
1 answer
37 views

Extracting information from HTML with XSLT 3.0 when data is grouped visually as siblings in a td separated by blank lines

I have a work-in-progress where I'm using XSLT 3 to extract information from some preprocessed archaic HTML. I'd like to produce JSON showing the relationships between the various entities for further ...
Forensic_07's user avatar
2 votes
1 answer
437 views

Using XSLT 3.0 to extract information from real-world HTML and produce JSON

For work, I extract information from HTML and XML sources to save in databases. The objective is to generate JSON representing the source document's information and its relationships in order to 1) ...
Forensic_07's user avatar
4 votes
1 answer
699 views

Enumerating ancestors in XSLT

I've been playing with some genealogical files in XML lately and wanted to create a transform that would list, for each person, the person's name, the count of ancestors, and the list of ancestors. ...
Edward's user avatar
  • 66.4k
2 votes
0 answers
2k views

XSLT find duplicate records

This transform is designed to look at a set of 50k-100k employee records and produce a CSV file of anyone who has the same type of benefit enrollment more than once. Each employee may or may not have ...
Matt's user avatar
  • 121
4 votes
1 answer
74 views

Converting a source XML to a target desired XML format

I have been able to create an XSLT (included) to convert a source XML to a target desired XML format (included). However, I am sure this can be optimized leveraging some built in XSLT capabilities ...
jeep's user avatar
  • 41
4 votes
1 answer
1k views

Extracting the first two initials of a person's name

I've come up with a hackish approach to get my XSL function to only return the first 2 initials of a person. I think there should be a more efficient way to do this though. The ...
chris85's user avatar
  • 143
2 votes
1 answer
40 views

Apply classes to selected XHTML elements based on content

I wish to take an XHTML source document (e.g. demo.in.xhtml below) and add class attributes to every td element whose content is ...
user avatar
2 votes
1 answer
433 views

Transforming XML to HTML with XSLT

I'm still learning from designing with types non strings by Scott Wlaschin. For my project I transform some XML to HTML with xslt. Because every filename can have side effects, they are stored in ...
Peter Siebke's user avatar
4 votes
1 answer
1k views

XSL template for converting XML to JSON

I used saxon v9 to profile an XSL transformation which converts XML to JSON. The profiler tells me that the function which escapes certain characters takes about 70% of the total processing time. The ...
Marged's user avatar
  • 173
2 votes
2 answers
3k views

Camel Case strings in XSLT

I have a situation where I am receiving data from a web service and the data is in all caps. I have to convert to HTML and format for display. In this case, we need the string to be normalized. The ...
Loren Shaw's user avatar
3 votes
1 answer
2k views

Validate XML using XSD, a Catalog Resolver, and JAXP DOM for XSLT

Background As this related question describes, there does not appear to be a canonical way to validate XML files against an XSD then subsequently transform them using an XSL template with file paths ...
Dave Jarvis's user avatar
  • 1,897
2 votes
0 answers
3k views

Capitalize words in XSLT 1.0

Since XSLT 1.0 doesn't have a lot of convenience functions, I have had to cobble them myself. The below capitalizes "words" in a string as defined by a string of delimiters. Is there any way to ...
kojiro's user avatar
  • 1,767
2 votes
1 answer
180 views

Calculation of trigonometric sine function

I'm creating a client-side pie chart in XSLT 1.0, without extensions or external dependencies (i.e., cannot use FXSLT, EXSLT, JavaScript, etc.). The code is slow; at least fifteen iterations are ...
Dave Jarvis's user avatar
  • 1,897
5 votes
1 answer
419 views

XSLT 2.0: Crawl HTML and add links

Background: I have 4 GB of text data dispersed in 250,000 html files. I want to interlink the files with <a> for the reader to click on. I have a 12 MB file ...
Paulb's user avatar
  • 153
3 votes
2 answers
15k views

Conditional assignment in XSLT?

I've written some XSLT where I want to assign values to some variables. Depending on whether or not a condition is met, I want the variable to be populated with a computed value and I want it to have ...
Vivian River's user avatar
13 votes
1 answer
2k views

Cross-language constants

I'm developing a web application that leverages multiple programming languages. The data flow resembles: Browser » PHP » PL/SQL » XML » XSLT » XHTML + JavaScript » Browser Using different languages ...
Dave Jarvis's user avatar
  • 1,897
3 votes
2 answers
209 views

Appendix answer key template

Goal: Extract all Appendix Titles If Appendix Title is Answer Key call custom solutions template If Not Answer Key call default appendix template XML: ...
Jessica Burnett's user avatar
4 votes
2 answers
591 views

Transforming XML as it is being generated on a scanner

At work I've recently been tasked with creating an XSLT to transform some XML as it is being generated on a scanner. The point being to disregard some pages that we are not interested in for further ...
Frank's user avatar
  • 230
1 vote
1 answer
159 views

How can I optimize my XSL file?

I am trying to learn to format XSL more efficiently. I can tell by the definition of duplicate variables and nearly identical templates that I did not create this efficiently at all. How could I ...
JoshT's user avatar
  • 19
1 vote
2 answers
172 views

Using Choose and Apply Templates with Mode, vs Complexless Template Matches

So I have a little XML (Sub)language, it has 3 elements of interest: para, point, and code ...
Frames Catherine White's user avatar
6 votes
1 answer
3k views

XML Schema for an XML representation of CSV

This is intended to be part of a generalised solution to the problem of converting any (with some minor restrictions) CSV content into XML. The restrictions on the CSV, and the purpose of the schema ...
Sean B. Durkin's user avatar
4 votes
2 answers
3k views

Making a flat file

Source XML (since I haven't bothered with a schema): ...
Frames Catherine White's user avatar
5 votes
1 answer
1k views

Controls to dump key/value pairs

Are there alternative (better) ways to factor out the common parts other than my use of abstract base class? I find myself following this pattern lately and it makes sense when I code it but ...
Aaron Anodide's user avatar
6 votes
1 answer
1k views

Using XSLT to turn content of WYSIWYG stored in XML into HTML

The CMS I use uses the Xalan XSLT processor which is a XSLT version 1.0 processor. Editors who use WYSIWYG fields within the CMS can save content that will look like either: ...
Jason Aller's user avatar