Quantcast

Xsl for each group issue in streaming mode

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Xsl for each group issue in streaming mode

Mailing Lists Mail


Dear All,

I have hit upon something that already seems to have been discussed and fixed. I am using  SaxonEE9-7-0-7J​ .. For this simple Case below. The <RootNode> is missing the end element </RootNode>

XML:

<RootNode>
<Groups>
<Group>
<specifics>
<specific>Subgroup1</specific>
<specific>Subgroup2</specific>
</specifics>
<Group_Detail>
<GroupIdentifier>G1</GroupIdentifier>
</Group_Detail>
</Group>
<Group>
<specifics>
<specific>Subgroup3</specific>
<specific>Subgroup4</specific>
</specifics>
<Group_Detail>
<GroupIdentifier>G1</GroupIdentifier>
</Group_Detail>
</Group>
<Group>
<specifics>
<specific>Subgroup1</specific>
<specific>Subgroup2</specific>
</specifics>
<Group_Detail>
<GroupIdentifier>G2</GroupIdentifier>
</Group_Detail>
</Group>
<Group>
<specifics>
<specific>Subgroup5</specific>
<specific>Subgroup6</specific>
</specifics>
<Group_Detail>
<GroupIdentifier>G2</GroupIdentifier>
</Group_Detail>
</Group>
</Groups>
</RootNode>

XSLT

<xsl:transform version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:mode name="stream" streamable="yes" on-no-match="shallow-copy"/>
<xsl:output method="xml" indent="yes"/>
<!--Define Global Variables by Streaming Input XML -->
<xsl:param name="fileHref" select="'file:///p:/Developers/perf/xslt3/For-EachGroup-Issue.xml'"/>
<xsl:variable name="outDir" select="substring-before($fileHref, tokenize($fileHref,'/')[last()])"/>
<xsl:variable name="OutFileName" select="substring-before($fileHref,'.xml') || '-Formatted.xml'"/>
<xsl:template match="/">
<xsl:result-document href="{$OutFileName}">
<xsl:stream href="{$fileHref}">
<xsl:apply-templates mode="stream"/>
</xsl:stream>
</xsl:result-document>
</xsl:template>
<xsl:template match="Groups" mode="stream">
<xsl:copy>
<xsl:for-each-group select="Group/copy-of(.)" group-by="Group_Detail/GroupIdentifier">
<xsl:variable name="GroupDetail" select="Group_Detail/copy-of(.)"/>
<xsl:variable name="groupId" select="$GroupDetail/GroupIdentifier"/>
<Formatted-Group groupId="{$groupId}">
<xsl:copy-of select="current-group()/specifics"/>
</Formatted-Group>
</xsl:for-each-group>
</xsl:copy>
</xsl:template>
</xsl:transform>

Result:

<?xml version="1.0" encoding="UTF-8"?>
<!-- See missing </RootNode> -->
<RootNode>
 <Groups>
  <Formatted-Group groupId="G1">
     <specifics>
 <specific>Subgroup1</specific>
 <specific>Subgroup2</specific>
</specifics>
<specifics>
<specific>Subgroup3</specific>
 <specific>Subgroup4</specific>
 </specifics>
</Formatted-Group>
<Formatted-Group groupId="G3">
<specifics>
 <specific>Subgroup1</specific>
<specific>Subgroup2</specific>
 </specifics>
 <specifics>
 <specific>Subgroup3</specific>
<specific>Subgroup4</specific>
</specifics>
</Formatted-Group>
<Formatted-Group groupId="G2">
 <specifics>
<specific>Subgroup5</specific>
 <specific>Subgroup6</specific>
</specifics>
</Formatted-Group>
 </Groups>

Best Regards, Dak Tapaal


------------------------------------------------------------------------------

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Xsl for each group issue in streaming mode

Michael Kay
Thanks for reporting this.

I copied the test case to the W3C test suite as test si-group-039, and when I run it using the test driver for that test suite, it appears to work OK. 

When I run it from the command line, it's OK as well.

I've now run it using 9.7.0.7 as released, without the latest unissued bug fixes, and that's OK too.

But Martin says he can reproduce the result, so there's obviously a bug there. I'll keep chasing it.

Michael Kay
Saxonica

On 22 Aug 2016, at 17:07, Mailing Lists Mail <[hidden email]> wrote:


Dear All,

I have hit upon something that already seems to have been discussed and fixed. I am using  SaxonEE9-7-0-7J​ .. For this simple Case below. The <RootNode> is missing the end element </RootNode>

XML:

<RootNode>
<Groups>
<Group>
<specifics>
<specific>Subgroup1</specific>
<specific>Subgroup2</specific>
</specifics>
<Group_Detail>
<GroupIdentifier>G1</GroupIdentifier>
</Group_Detail>
</Group>
<Group>
<specifics>
<specific>Subgroup3</specific>
<specific>Subgroup4</specific>
</specifics>
<Group_Detail>
<GroupIdentifier>G1</GroupIdentifier>
</Group_Detail>
</Group>
<Group>
<specifics>
<specific>Subgroup1</specific>
<specific>Subgroup2</specific>
</specifics>
<Group_Detail>
<GroupIdentifier>G2</GroupIdentifier>
</Group_Detail>
</Group>
<Group>
<specifics>
<specific>Subgroup5</specific>
<specific>Subgroup6</specific>
</specifics>
<Group_Detail>
<GroupIdentifier>G2</GroupIdentifier>
</Group_Detail>
</Group>
</Groups>
</RootNode>

XSLT

<xsl:transform version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:mode name="stream" streamable="yes" on-no-match="shallow-copy"/>
<xsl:output method="xml" indent="yes"/>
<!--Define Global Variables by Streaming Input XML -->
<xsl:param name="fileHref" select="'file:///p:/Developers/perf/xslt3/For-EachGroup-Issue.xml'"/>
<xsl:variable name="outDir" select="substring-before($fileHref, tokenize($fileHref,'/')[last()])"/>
<xsl:variable name="OutFileName" select="substring-before($fileHref,'.xml') || '-Formatted.xml'"/>
<xsl:template match="/">
<xsl:result-document href="{$OutFileName}">
<xsl:stream href="{$fileHref}">
<xsl:apply-templates mode="stream"/>
</xsl:stream>
</xsl:result-document>
</xsl:template>
<xsl:template match="Groups" mode="stream">
<xsl:copy>
<xsl:for-each-group select="Group/copy-of(.)" group-by="Group_Detail/GroupIdentifier">
<xsl:variable name="GroupDetail" select="Group_Detail/copy-of(.)"/>
<xsl:variable name="groupId" select="$GroupDetail/GroupIdentifier"/>
<Formatted-Group groupId="{$groupId}">
<xsl:copy-of select="current-group()/specifics"/>
</Formatted-Group>
</xsl:for-each-group>
</xsl:copy>
</xsl:template>
</xsl:transform>

Result:

<?xml version="1.0" encoding="UTF-8"?>
<!-- See missing </RootNode> -->
<RootNode>
 <Groups>
  <Formatted-Group groupId="G1">
     <specifics>
 <specific>Subgroup1</specific>
 <specific>Subgroup2</specific>
</specifics>
<specifics>
<specific>Subgroup3</specific>
 <specific>Subgroup4</specific>
 </specifics>
</Formatted-Group>
<Formatted-Group groupId="G3">
<specifics>
 <specific>Subgroup1</specific>
<specific>Subgroup2</specific>
 </specifics>
 <specifics>
 <specific>Subgroup3</specific>
<specific>Subgroup4</specific>
</specifics>
</Formatted-Group>
<Formatted-Group groupId="G2">
 <specifics>
<specific>Subgroup5</specific>
 <specific>Subgroup6</specific>
</specifics>
</Formatted-Group>
 </Groups>

Best Regards, Dak Tapaal



------------------------------------------------------------------------------

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Xsl for each group issue in streaming mode

Michael Kay
Now reproduced. My attempts to run it using 9.7.0.7 as issued were actually showing the bug, but I failed to realise it because I was looking at the output from running it under the current 9.7.0.8 build, where it appears to produce correct results.

So it looks like a bug that's present in 9.7.0.7 but fixed in our internal development branch.

That means it's pretty clearly the same bug as


We should have a 9.8.0.8 maintenance release out soon, probably next week when O'Neil is back from vacation. There's quite a queue of fixes ready to go out, which means we could hit a few hiccups when we run the full test suite, but it's usually a fairly smooth process these days.

Best regards,

Michael Kay
Saxonica


On 23 Aug 2016, at 18:26, Michael Kay <[hidden email]> wrote:

Thanks for reporting this.

I copied the test case to the W3C test suite as test si-group-039, and when I run it using the test driver for that test suite, it appears to work OK. 

When I run it from the command line, it's OK as well.

I've now run it using 9.7.0.7 as released, without the latest unissued bug fixes, and that's OK too.

But Martin says he can reproduce the result, so there's obviously a bug there. I'll keep chasing it.

Michael Kay
Saxonica

On 22 Aug 2016, at 17:07, Mailing Lists Mail <[hidden email]> wrote:


Dear All,

I have hit upon something that already seems to have been discussed and fixed. I am using  SaxonEE9-7-0-7J​ .. For this simple Case below. The <RootNode> is missing the end element </RootNode>

XML:

<RootNode>
<Groups>
<Group>
<specifics>
<specific>Subgroup1</specific>
<specific>Subgroup2</specific>
</specifics>
<Group_Detail>
<GroupIdentifier>G1</GroupIdentifier>
</Group_Detail>
</Group>
<Group>
<specifics>
<specific>Subgroup3</specific>
<specific>Subgroup4</specific>
</specifics>
<Group_Detail>
<GroupIdentifier>G1</GroupIdentifier>
</Group_Detail>
</Group>
<Group>
<specifics>
<specific>Subgroup1</specific>
<specific>Subgroup2</specific>
</specifics>
<Group_Detail>
<GroupIdentifier>G2</GroupIdentifier>
</Group_Detail>
</Group>
<Group>
<specifics>
<specific>Subgroup5</specific>
<specific>Subgroup6</specific>
</specifics>
<Group_Detail>
<GroupIdentifier>G2</GroupIdentifier>
</Group_Detail>
</Group>
</Groups>
</RootNode>

XSLT

<xsl:transform version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:mode name="stream" streamable="yes" on-no-match="shallow-copy"/>
<xsl:output method="xml" indent="yes"/>
<!--Define Global Variables by Streaming Input XML -->
<xsl:param name="fileHref" select="'file:///p:/Developers/perf/xslt3/For-EachGroup-Issue.xml'"/>
<xsl:variable name="outDir" select="substring-before($fileHref, tokenize($fileHref,'/')[last()])"/>
<xsl:variable name="OutFileName" select="substring-before($fileHref,'.xml') || '-Formatted.xml'"/>
<xsl:template match="/">
<xsl:result-document href="{$OutFileName}">
<xsl:stream href="{$fileHref}">
<xsl:apply-templates mode="stream"/>
</xsl:stream>
</xsl:result-document>
</xsl:template>
<xsl:template match="Groups" mode="stream">
<xsl:copy>
<xsl:for-each-group select="Group/copy-of(.)" group-by="Group_Detail/GroupIdentifier">
<xsl:variable name="GroupDetail" select="Group_Detail/copy-of(.)"/>
<xsl:variable name="groupId" select="$GroupDetail/GroupIdentifier"/>
<Formatted-Group groupId="{$groupId}">
<xsl:copy-of select="current-group()/specifics"/>
</Formatted-Group>
</xsl:for-each-group>
</xsl:copy>
</xsl:template>
</xsl:transform>

Result:

<?xml version="1.0" encoding="UTF-8"?>
<!-- See missing </RootNode> -->
<RootNode>
 <Groups>
  <Formatted-Group groupId="G1">
     <specifics>
 <specific>Subgroup1</specific>
 <specific>Subgroup2</specific>
</specifics>
<specifics>
<specific>Subgroup3</specific>
 <specific>Subgroup4</specific>
 </specifics>
</Formatted-Group>
<Formatted-Group groupId="G3">
<specifics>
 <specific>Subgroup1</specific>
<specific>Subgroup2</specific>
 </specifics>
 <specifics>
 <specific>Subgroup3</specific>
<specific>Subgroup4</specific>
</specifics>
</Formatted-Group>
<Formatted-Group groupId="G2">
 <specifics>
<specific>Subgroup5</specific>
 <specific>Subgroup6</specific>
</specifics>
</Formatted-Group>
 </Groups>

Best Regards, Dak Tapaal


------------------------------------------------------------------------------
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help


------------------------------------------------------------------------------

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Xsl for each group issue in streaming mode

Mailing Lists Mail

Thanks Michael,
Will it be possible for you to send me a version of saxon that i can run and prove to my group that things work. Currently i am advocating for saxon and xslt3 streaming and i am kind of being questioned...
Dak tapaal..


On Aug 23, 2016 1:47 PM, "Michael Kay" <[hidden email]> wrote:
Now reproduced. My attempts to run it using 9.7.0.7 as issued were actually showing the bug, but I failed to realise it because I was looking at the output from running it under the current 9.7.0.8 build, where it appears to produce correct results.

So it looks like a bug that's present in 9.7.0.7 but fixed in our internal development branch.

That means it's pretty clearly the same bug as


We should have a 9.8.0.8 maintenance release out soon, probably next week when O'Neil is back from vacation. There's quite a queue of fixes ready to go out, which means we could hit a few hiccups when we run the full test suite, but it's usually a fairly smooth process these days.

Best regards,

Michael Kay
Saxonica


On 23 Aug 2016, at 18:26, Michael Kay <[hidden email]> wrote:

Thanks for reporting this.

I copied the test case to the W3C test suite as test si-group-039, and when I run it using the test driver for that test suite, it appears to work OK. 

When I run it from the command line, it's OK as well.

I've now run it using 9.7.0.7 as released, without the latest unissued bug fixes, and that's OK too.

But Martin says he can reproduce the result, so there's obviously a bug there. I'll keep chasing it.

Michael Kay
Saxonica

On 22 Aug 2016, at 17:07, Mailing Lists Mail <[hidden email]> wrote:


Dear All,

I have hit upon something that already seems to have been discussed and fixed. I am using  SaxonEE9-7-0-7J​ .. For this simple Case below. The <RootNode> is missing the end element </RootNode>

XML:

<RootNode>
<Groups>
<Group>
<specifics>
<specific>Subgroup1</specific>
<specific>Subgroup2</specific>
</specifics>
<Group_Detail>
<GroupIdentifier>G1</GroupIdentifier>
</Group_Detail>
</Group>
<Group>
<specifics>
<specific>Subgroup3</specific>
<specific>Subgroup4</specific>
</specifics>
<Group_Detail>
<GroupIdentifier>G1</GroupIdentifier>
</Group_Detail>
</Group>
<Group>
<specifics>
<specific>Subgroup1</specific>
<specific>Subgroup2</specific>
</specifics>
<Group_Detail>
<GroupIdentifier>G2</GroupIdentifier>
</Group_Detail>
</Group>
<Group>
<specifics>
<specific>Subgroup5</specific>
<specific>Subgroup6</specific>
</specifics>
<Group_Detail>
<GroupIdentifier>G2</GroupIdentifier>
</Group_Detail>
</Group>
</Groups>
</RootNode>

XSLT

<xsl:transform version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:mode name="stream" streamable="yes" on-no-match="shallow-copy"/>
<xsl:output method="xml" indent="yes"/>
<!--Define Global Variables by Streaming Input XML -->
<xsl:param name="fileHref" select="'file:///p:/Developers/perf/xslt3/For-EachGroup-Issue.xml'"/>
<xsl:variable name="outDir" select="substring-before($fileHref, tokenize($fileHref,'/')[last()])"/>
<xsl:variable name="OutFileName" select="substring-before($fileHref,'.xml') || '-Formatted.xml'"/>
<xsl:template match="/">
<xsl:result-document href="{$OutFileName}">
<xsl:stream href="{$fileHref}">
<xsl:apply-templates mode="stream"/>
</xsl:stream>
</xsl:result-document>
</xsl:template>
<xsl:template match="Groups" mode="stream">
<xsl:copy>
<xsl:for-each-group select="Group/copy-of(.)" group-by="Group_Detail/GroupIdentifier">
<xsl:variable name="GroupDetail" select="Group_Detail/copy-of(.)"/>
<xsl:variable name="groupId" select="$GroupDetail/GroupIdentifier"/>
<Formatted-Group groupId="{$groupId}">
<xsl:copy-of select="current-group()/specifics"/>
</Formatted-Group>
</xsl:for-each-group>
</xsl:copy>
</xsl:template>
</xsl:transform>

Result:

<?xml version="1.0" encoding="UTF-8"?>
<!-- See missing </RootNode> -->
<RootNode>
 <Groups>
  <Formatted-Group groupId="G1">
     <specifics>
 <specific>Subgroup1</specific>
 <specific>Subgroup2</specific>
</specifics>
<specifics>
<specific>Subgroup3</specific>
 <specific>Subgroup4</specific>
 </specifics>
</Formatted-Group>
<Formatted-Group groupId="G3">
<specifics>
 <specific>Subgroup1</specific>
<specific>Subgroup2</specific>
 </specifics>
 <specifics>
 <specific>Subgroup3</specific>
<specific>Subgroup4</specific>
</specifics>
</Formatted-Group>
<Formatted-Group groupId="G2">
 <specifics>
<specific>Subgroup5</specific>
 <specific>Subgroup6</specific>
</specifics>
</Formatted-Group>
 </Groups>

Best Regards, Dak Tapaal


------------------------------------------------------------------------------
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help


------------------------------------------------------------------------------

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Xsl for each group issue in streaming mode

Michael Kay


Thanks Michael,
Will it be possible for you to send me a version of saxon that i can run and prove to my group that things work. Currently i am advocating for saxon and xslt3 streaming and i am kind of being questioned...
Dak tapaal..

No, I'm sorry, you'll have to wait for the next maintenance release. But we'll try to make that as soon as we can.

Michael Kay
Saxonica

------------------------------------------------------------------------------

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Loading...