formatting XPath expressions in XSLT 3 text templates
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 102
- Joined: Tue Aug 19, 2014 12:04 pm
formatting XPath expressions in XSLT 3 text templates
Post by Martin Honnen »
Using XML Editor 21.0, build 2019040204, I am struggling to get some nice formatting of XPath expressions in XSLT 3 text templates.
For instance, imagine I have prototyped some XPath code in the XPath builder e.g.
and now open a new XQuery file and paste that code and use the format and indent button I get a nice formatting and indentation (although the indentation seems to get lost here in the forum when pasting into a code BB block):
However, when I create a new XSLT 3 document and paste the expression into a text template and use the format and indent button I get some rather messy result, the XPath expression is not formatted well:
Is there some way to get a better formatting and indentation of XPath expressions in XSLT text templates?
For instance, imagine I have prototyped some XPath code in the XPath builder e.g.
Code: Select all
serialize(array { let $s := ('a', 'b', 'c', 'd') return for-each-pair($s[position() mod 2 = 1], $s[position() mod 2 = 0], function ($s1,$s2) { [$s2, $s1] }) }, map { 'method' : 'json', 'indent' : true() })
Code: Select all
serialize(array {
let $s := ('a', 'b', 'c', 'd')
return
for-each-pair($s[position() mod 2 = 1], $s[position() mod 2 = 0], function ($s1, $s2) {
[$s2, $s1]
})
}, map {
'method': 'json',
'indent': true()
})
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:math="http://www.w3.org/2005/xpath-functions/math" exclude-result-prefixes="xs math"
version="3.0">
<xsl:template name="xsl:initial-template">{serialize(array { let $s := ('a', 'b', 'c', 'd')
return for-each-pair($s[position() mod 2 = 1], $s[position() mod 2 = 0], function ($s1,$s2)
{ [$s2, $s1] }) }, map { 'method' : 'json', 'indent' : true() })}</xsl:template>
</xsl:stylesheet>
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: formatting XPath expressions in XSLT 3 text templates
Hi,
In short, there isn't. The XSLT formatter does not format XPath expressions from text templates on multiple lines, it just wraps the line at the line limit.
I've logged an improvement request.
Regards,
Adrian
In short, there isn't. The XSLT formatter does not format XPath expressions from text templates on multiple lines, it just wraps the line at the line limit.
I've logged an improvement request.
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service