xsl-list
[Top] [All Lists]

Re: [xsl] Confusion with generated xsl

2018-05-21 09:56:56
Thank you Michael,
Yes that did the job. I felt sure I had tried that but obviously not!
Just one more question, is there any xsl or xpath construct that can't be
generated using xslt?

Best regards
Ian

-----Original Message-----
From: Michael Kay mike(_at_)saxonica(_dot_)com
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> 
Sent: 21 May 2018 15:00
To: xsl-list <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Subject: Re: [xsl] Confusion with generated xsl

How can I generate an attribute value template without the {} becoming 
active and forcing the XPath to be evaluated before it's ready?

You need to double the curly braces.

<thing value="abc{{$x}}"/>

in the (meta-)stylesheet will generate

<thing value="abc{$x}"/>

in the output file (the generated stylesheet)

Michael Kay
Saxonica


On 21 May 2018, at 14:53, ian(_dot_)proudfoot(_at_)itp-x(_dot_)co(_dot_)uk
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

Hello XSL community,

I have been creating a content conversion system using XSLT 3.0 with 
Saxon PE 9.8.0.8 in Oxygen 20.0. The production version is being 
tested with Saxon PE 9.8.0.11J.
The workflow is to pre-process and simplify the source XML into a 
flatter and more consistent intermediate format. A second transform 
then uses the input from a mapping file to generate an XSLT file that 
is subsequently used to transform the intermediate output into the
required final output.

I'm satisfied with the way almost everything works so far. However 
creating the stylesheet for generating xsl is rather more complex than 
expected. I don't know if there is a normal way to do this, but I 
manually created a sample XSL file that performed a typical 
transformation that was to be done by the generated version. I then 
set-about creating that dynamically via a transform, of course using 
namespace-alias to generate all of the required templates, functions,
variables and so-on. So here's where I'm getting lost.
How can I generate an attribute value template without the {} becoming 
active and forcing the XPath to be evaluated before it's ready? In 
some cases I've created a function that wraps the target XPath in 
curly brackets but for some cases that seems no to work. Generating 
element names this was always seems to fail.

This is the typical output that I need from the generated stylesheet.
(Nothing special about my function, it just assembles the element name 
the way I need depending on three arguments.) <xsl:element 
name="{itpx:getDoctype(@style, $mapToDoctype, 0)}">...
In the stylesheet that generates the xsl would there be any reason to 
give the itpx namespace an alias too?

Perhaps I'm just over-thinking it?
Thanks any guidance.
Ian

iTP-X
+44 (0) 7793 324 581
ian(_dot_)proudfoot(_at_)itp-x(_dot_)co(_dot_)uk

Bembridge
Isle of Wight
United Kingdom

--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>