Re: [xsl] Confusion with generated xsl

Subject: Re: [xsl] Confusion with generated xsl
From: "ian.proudfoot@xxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 21 May 2018 14:56:51 -0000
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@xxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> 
Sent: 21 May 2018 15:00
To: xsl-list <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
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.proudfoot@xxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> 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.proudfoot@xxxxxxxxxxx
> 
> Bembridge
> Isle of Wight
> United Kingdom

Current Thread