libxml issue #290

Closed
opened 2024-06-05 09:41:15 +02:00 by szewczyw · 1 comment
Collaborator
<?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:exsl="http://exslt.org/common" xmlns:b="http://www.demo.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:a="http://www.demo.com/author" xmlns:p="http://www.demo.com/person" xmlns:date="http://exslt.org/dates-and-times" version="1.0" extension-element-prefixes="exsl" xsi:schemaLocation="http://exslt.org/common ">
<xsl:variable name="books">

<b:book id="1">
Hamlet
2001-05-04
1
false
</b:book>
<b:book id="2">
Macbeth
2000-12-13
1
false
</b:book>
<b:book id="3">
Harry Potter and the Sorcerer's Stone
2005-04-29
2
true
</b:book>
<b:book id="4">
The Long Walk
2018-07-01
4
true
</b:book>
<b:book id="5">
Misery
2018-01-31
4
true
</b:book>
<b:book id="6">
Think and Grow Rich
2004-09-10
6
true
</b:book>
<b:book id="7">
The Law of Success
1982-05-09
6
false
</b:book>
<b:book id="8">
Patriot Games
1995-10-21
5
false
</b:book>
<b:book id="9">
The Sum of All Fears
1992-09-19
5
false
</b:book>
<b:book id="10">
The Alchemist
2017-02-20
3
false
</b:book>
<b:book id="11">
Hamlet
1994-06-01
1
false
</b:book>
<b:book id="12">
Measure for Measure
1990-03-23
1
false
</b:book>
<b:book id="13">
Hamlet
1989-05-05
1
true
</b:book>
<b:book id="14">
Hamlet
1999-05-30
1
true
</b:book>
<b:book id="15">
The Law of Success
2004-11-26
6
true
</b:book>
<b:book id="16">
Romeo and Juliet
1997-02-08
1
true
</b:book>
<b:book id="17">
The Alchemist
2009-08-21
3
true
</b:book>

</xsl:variable>
<xsl:template match="/">
<xsl:for-each select="a:authors/a:author">
<xsl:variable name="currentAuthorId" select="@id"/>
<xsl:copy-of select="."/>

<xsl:for-each select="exsl:node-set($books)/b:books/b:book[b:authorId=$currentAuthorId]">
<xsl:copy-of select="."/>
</xsl:for-each>

</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

works perfectly on xalan, doesn't work at all with libxml

<?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:exsl="http://exslt.org/common" xmlns:b="http://www.demo.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:a="http://www.demo.com/author" xmlns:p="http://www.demo.com/person" xmlns:date="http://exslt.org/dates-and-times" version="1.0" extension-element-prefixes="exsl" xsi:schemaLocation="http://exslt.org/common "> <xsl:variable name="books"> <books xmlns="http://www.demo.com" xmlns:b="http://www.demo.com"> <b:book id="1"> <name>Hamlet</name> <date>2001-05-04</date> <authorId>1</authorId> <availability>false</availability> </b:book> <b:book id="2"> <name>Macbeth</name> <date>2000-12-13</date> <authorId>1</authorId> <availability>false</availability> </b:book> <b:book id="3"> <name>Harry Potter and the Sorcerer's Stone</name> <date>2005-04-29</date> <authorId>2</authorId> <availability>true</availability> </b:book> <b:book id="4"> <name>The Long Walk</name> <date>2018-07-01</date> <authorId>4</authorId> <availability>true</availability> </b:book> <b:book id="5"> <name>Misery</name> <date>2018-01-31</date> <authorId>4</authorId> <availability>true</availability> </b:book> <b:book id="6"> <name>Think and Grow Rich</name> <date>2004-09-10</date> <authorId>6</authorId> <availability>true</availability> </b:book> <b:book id="7"> <name>The Law of Success</name> <date>1982-05-09</date> <authorId>6</authorId> <availability>false</availability> </b:book> <b:book id="8"> <name>Patriot Games</name> <date>1995-10-21</date> <authorId>5</authorId> <availability>false</availability> </b:book> <b:book id="9"> <name>The Sum of All Fears</name> <date>1992-09-19</date> <authorId>5</authorId> <availability>false</availability> </b:book> <b:book id="10"> <name>The Alchemist</name> <date>2017-02-20</date> <authorId>3</authorId> <availability>false</availability> </b:book> <b:book id="11"> <name>Hamlet</name> <date>1994-06-01</date> <authorId>1</authorId> <availability>false</availability> </b:book> <b:book id="12"> <name>Measure for Measure</name> <date>1990-03-23</date> <authorId>1</authorId> <availability>false</availability> </b:book> <b:book id="13"> <name>Hamlet</name> <date>1989-05-05</date> <authorId>1</authorId> <availability>true</availability> </b:book> <b:book id="14"> <name>Hamlet</name> <date>1999-05-30</date> <authorId>1</authorId> <availability>true</availability> </b:book> <b:book id="15"> <name>The Law of Success</name> <date>2004-11-26</date> <authorId>6</authorId> <availability>true</availability> </b:book> <b:book id="16"> <name>Romeo and Juliet</name> <date>1997-02-08</date> <authorId>1</authorId> <availability>true</availability> </b:book> <b:book id="17"> <name>The Alchemist</name> <date>2009-08-21</date> <authorId>3</authorId> <availability>true</availability> </b:book> </books> </xsl:variable> <xsl:template match="/"> <xsl:for-each select="a:authors/a:author"> <xsl:variable name="currentAuthorId" select="@id"/> <xsl:copy-of select="."/> <books> <xsl:for-each select="exsl:node-set($books)/b:books/b:book[b:authorId=$currentAuthorId]"> <xsl:copy-of select="."/> </xsl:for-each> </books> </xsl:for-each> </xsl:template> </xsl:stylesheet> works perfectly on xalan, doesn't work at all with libxml
Collaborator

fixed in #297

fixed in #297
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: R11/release11-tools#290
No description provided.