Martin Honnen |
Advanced Member |
|
|
|
|
None Specified |
|
Sunday, June 10, 2007 |
Friday, September 28, 2018 3:54:29 PM |
36 [0.20% of all post / 0.01 posts per day] |
|
Using Altova XML Spy Professional Edition version 2018 rel. 2 SP1 (x64) I wonder where I would see any "xsl:assert" message when running or debugging an XSLT 3 stylesheet.
As far as I understand it from https://www.w3.org/TR/xslt-30/#assertions, "By default, assertions are disabled".
Is there any way in XMLSpy to enable them for the execution and/or debugging of an XSLT 3 stylesheet (with XMLSpy's built-in XSLT 3 engine)?
|
Thanks a lot. Still not sure why the project didn't include the files, but a careful search with file explorer has now also shown that they are in the project folder in the file system, somehow the XMLSpy project file didn't include them. But thanks again, now with the files I can better understand how the new features presented in the video work.
|
I have just watched the video https://youtu.be/Hd5W6IpDA8Y?t=189 and it shows a subfolder XSLT/XQuery of the JSON examples folder in the Altova 2018 examples, however with my installation of the Altova XMLSpy Professional Edition updated to 2018 release 2 I don't find that XSLT/XQuery subfolder of the JSON Examples folder. Does anyone else have that subfolder in his examples project? Does the update not update that examples project properly?
In general, when transforming a JSON input document with XSLT 3, what is the global context item, what is the initial match selection, does processing start with a named template or by applying a template matching the initial match selection?
|
I don't think a key can solve that but assuming XSLT 2.0 or higher you have regular expression support and can use
Code: <xsl:value-of select="$LookupDoc/Row[matches($curr_key, @Key1)]/@ElementType"/>
|
Can you show us the data passed in as $curr_key you want to compare? A key works with an exact value comparison https://www.w3.org/TR/xslt20/#keys with the eq operator so it is not clear what you want to achieve.
|
I am bit confused about the state of XSLT 3.0 support in the latest XMLSpy release, the section https://www.altova.com/whatsnew.html says
Quote:Support for additional XSLT 3.0 instructions
A number of new instructions are now supported, including:
Static variables & parameters Shadow attributes Pattern matching of any item (not just nodes) - apply-templates for any item xsl:accumulator xsl:accumulator-rule xsl:break xsl:context-item
xsl:fork xsl:global-context-item xsl:iterate xsl:merge xsl:merge-key xsl:merge-action xsl:merge-source xsl:next-iteration xsl:on-completion
so it lists elements like xsl:merge or xsl:fork which are new in XSLT 3.0. On the other hand, when I look at the online manual http://manual.altova.com/XMLSpy/spyprofessional/ and the page http://manual.altova.com/XMLSpy/spyprofessional/index.html?xsxqengine_xslt30.htm it explicitly states
Quote:The following XSLT 3.0 instructions are currently unsupported:
xsl:accept
xsl:accumulator
xsl:accumulator-rule
xsl:break
xsl:context-item
xsl:expose
xsl:fork
xsl:iterate
xsl:merge xsl:merge-action xsl:merge-key xsl:merge-source xsl:mode xsl:next-iteration xsl:next-match xsl:on-completion xsl:override xsl:package xsl:stream xsl:use-package
Has the online documentation not been updated?
If stuff like xsl:merge or xsl:fork is supported, is there also support for streamed XSLT processing, e.g. doing
Code:xsl:merge-source for-each-stream="'input.xml', 'input2.xml'" select="/root/foo" streamable="yes"
?
|
I thought the support engineers might read here too and raise a bug in the bug system themselves if they agree on my assessment. And I am usually struggling to get my bug reports through the bug reporting web site. But I managed on the second attempt to file a related bug on XSLT and will try the same approach for this problem, sorry for the hassle.
|
Using
Quote:AltovaXML Community Edition Version 2013 Copyright (c) 1998-2012 Altova GmbH. All rights reserved. build: Sep 14 2012, 02:13:05 I am trying to validate the document http://home.arcor.de/martin.honnen/xml/oneCharInstance1.xml against the schema http://home.arcor.de/martin.honnen/xml/oneCharSchema1.xsd. I get the following validation error:Quote:The XML data is invalid. Value '𐌀' is not allowed for element <test>.
When I validate the same files with other schema validating XML parsers like Saxon 9.4 EE or like XSV (see result) I get no validation errors.
I think AltovaXML is wrong to report a validation error, in terms of XML a character like 𐌀 is a single XML character and therefore the "test" element is valid against the schema allowing a string of length 1 as the content.
|
If the input XML is
Code:
<Root> <Location> <LocationGid> <Gid> <Xid>Loc1</Xid> </Gid> </LocationGid> <LocationName>Area 1</LocationName> </Location> <Location> <LocationGid> <Gid> <Xid>Loc2</Xid> </Gid> </LocationGid> <LocationName>Area 2</LocationName> </Location> <Location> <LocationGid> <Gid> <Xid>Loc3</Xid> </Gid> </LocationGid> <LocationName>Area3</LocationName> </Location> <Release> <ShipFromLocationRef> <LocationRef> <LocationGid> <Gid> <Xid>Loc2</Xid> </Gid> </LocationGid> </LocationRef> </ShipFromLocationRef> </Release> </Root>
then this stylesheet
Code: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs"> <xsl:output method="text"/> <xsl:key name="k1" match="Location" use="LocationGid/Gid/Xid"/> <xsl:template match="/"> <xsl:value-of select="key('k1', /Root/Release/ShipFromLocationRef/LocationRef/LocationGid/Gid/Xid)/LocationName"/> </xsl:template>
</xsl:stylesheet>
outputs
So using xsl: key and the key function is the right way with XSLT to process cross-references in an XML document.
|
If the attribute is present but its value is the empty string then I think with version="2.0" there should indeed an error be raised, with version="1.0" and an XSLT 2.0 processor implementing backwards compatibility mode then result should be "NaN". However Altova still raises an error. Saxon 9 does not. You might want to code
Code:format-number(if (@bar castable as xs:double) then @bar else number(''), '$#,##0.00') I think that gives the behaviour you want with an XSLT 2.0 processor, independent of the XSLT version attribute in the stylesheet.
|
|