Skip to content

Commit

Permalink
bug 12
Browse files Browse the repository at this point in the history
  • Loading branch information
frederikbosch committed Apr 5, 2016
1 parent 27b0a72 commit b832d13
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/Integration/ProcessXslt1DocumentsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,4 +222,23 @@ public function testAmpersandEscaped()

$this->assertEquals($nativeResult, $transpilerResult);
}

public function testBug12()
{
$xslDoc = new DOMDocument();
$xslDoc->load('Stubs/item-types.xsl');

$xmlDoc = new DOMDocument();
$xmlDoc->load('Stubs/item-types.xml');

$native = new \XSLTProcessor();
$native->importStylesheet($xslDoc);
$nativeResult = $native->transformToXML($xmlDoc);

$transpiler = new XsltProcessor();
$transpiler->importStylesheet($xslDoc);
$transpilerResult = $transpiler->transformToXML($xmlDoc);

$this->assertEquals($nativeResult, $transpilerResult);
}
}
5 changes: 5 additions & 0 deletions tests/Stubs/item-types.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<ItemTypes>
<Item id="test">
<Requirement id="subtest" min="10"/>
</Item>
</ItemTypes>
12 changes: 12 additions & 0 deletions tests/Stubs/item-types.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
<xsl:apply-templates select=".//Requirement" mode="min"/>
</xsl:template>

<xsl:template match="Requirement|EffectReq" mode="min">
<xsl:value-of select="count(id(@id)/preceding-sibling::*)"/> => <xsl:value-of select="@min"/><xsl:if test="position()!=last()">, </xsl:if>
</xsl:template>

</xsl:stylesheet>

0 comments on commit b832d13

Please sign in to comment.