-
-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support of XSLT 2.0 #999
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
03d97f4
#5801 - removed xalan dependencies
lgoltz 14265cc
#5801 - removed xerces dependency from all other modules than deegree…
lgoltz b3b51c0
#5801 - updated xerces to 2.12.0
lgoltz e06ef6c
#5801 - use XsltUtils
lgoltz a9d84db
#5801 - added saxon dependency; added unit test to verify support of …
lgoltz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
deegree-core/deegree-core-commons/src/test/java/org/deegree/commons/xml/XsltUtilsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package org.deegree.commons.xml; | ||
|
||
import static org.hamcrest.CoreMatchers.containsString; | ||
import static org.hamcrest.CoreMatchers.instanceOf; | ||
import static org.hamcrest.CoreMatchers.is; | ||
import static org.junit.Assert.assertThat; | ||
|
||
import java.io.ByteArrayOutputStream; | ||
import java.io.InputStream; | ||
import java.net.URL; | ||
|
||
import javax.xml.transform.TransformerFactory; | ||
|
||
import org.junit.Test; | ||
|
||
/** | ||
* @author <a href="mailto:goltz@lat-lon.de">Lyn Goltz </a> | ||
*/ | ||
public class XsltUtilsTest { | ||
|
||
@Test | ||
public void verifyXslt_20_ImplementationIsAvailable() { | ||
TransformerFactory factory = TransformerFactory.newInstance(); | ||
assertThat( factory, is( instanceOf( net.sf.saxon.TransformerFactoryImpl.class ) ) ); | ||
} | ||
|
||
@Test | ||
public void testXslt10() | ||
throws Exception { | ||
InputStream docToTransform = XsltUtilsTest.class.getResourceAsStream( "feature.gml" ); | ||
URL xslt = XsltUtilsTest.class.getResource( "featureToHtml-Xslt10.xslt" ); | ||
ByteArrayOutputStream bos = new ByteArrayOutputStream(); | ||
XsltUtils.transform( docToTransform, xslt, bos ); | ||
bos.close(); | ||
|
||
assertThat( bos.toString(), containsString( "Identifier: i1 Name: feature name 1 Props: 1a, 1b" ) ); | ||
assertThat( bos.toString(), containsString( "Identifier: i2 Name: feature name 2 Props: 2a, 2b, 2c" ) ); | ||
} | ||
|
||
@Test | ||
public void testXslt20() | ||
throws Exception { | ||
InputStream docToTransform = XsltUtilsTest.class.getResourceAsStream( "feature.gml" ); | ||
URL xslt = XsltUtilsTest.class.getResource( "featureToHtml-Xslt20.xslt" ); | ||
ByteArrayOutputStream bos = new ByteArrayOutputStream(); | ||
XsltUtils.transform( docToTransform, xslt, bos ); | ||
bos.close(); | ||
|
||
assertThat( bos.toString(), containsString( "Identifier: i1 Name: feature name 1 Props: 1a, 1b" ) ); | ||
assertThat( bos.toString(), containsString( "Identifier: i2 Name: feature name 2 Props: 2a, 2b, 2c" ) ); | ||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
deegree-core/deegree-core-commons/src/test/resources/org/deegree/commons/xml/feature.gml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<gml:FeatureCollection xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:app="http://deegree.org/app"> | ||
<gml:boundedBy> | ||
<gml:Envelope srsName="EPSG:25833"> | ||
<gml:lowerCorner>334830.868300 5871407.128200</gml:lowerCorner> | ||
<gml:upperCorner>358634.056200 5900836.645100</gml:upperCorner> | ||
</gml:Envelope> | ||
</gml:boundedBy> | ||
<gml:featureMember> | ||
<app:Instance gml:id="Instance_1"> | ||
<app:identifier>i1</app:identifier> | ||
<app:name>feature name 1</app:name> | ||
<app:prop1>1a</app:prop1> | ||
<app:prop1>1b</app:prop1> | ||
</app:Instance> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<app:Instance gml:id="Instance_2"> | ||
<app:identifier>i2</app:identifier> | ||
<app:name>feature name 2</app:name> | ||
<app:prop1>2a</app:prop1> | ||
<app:prop1>2b</app:prop1> | ||
<app:prop1>2c</app:prop1> | ||
</app:Instance> | ||
</gml:featureMember> | ||
</gml:FeatureCollection> |
36 changes: 36 additions & 0 deletions
36
...deegree-core-commons/src/test/resources/org/deegree/commons/xml/featureToHtml-Xslt10.xslt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0"?> | ||
<xsl:stylesheet version="1.0" | ||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
xmlns:app="http://deegree.org/app"> | ||
|
||
<xsl:output method="html" indent="yes"/> | ||
|
||
<xsl:template match="/"> | ||
<html lang="de"> | ||
<head/> | ||
<body> | ||
<div> | ||
<ul> | ||
<xsl:for-each select="//app:Instance"> | ||
<xsl:apply-templates select="."/> | ||
</xsl:for-each> | ||
</ul> | ||
</div> | ||
</body> | ||
</html> | ||
</xsl:template> | ||
|
||
<xsl:template match="app:Instance"> | ||
<li> | ||
<xsl:text>Identifier: </xsl:text> | ||
<xsl:value-of select="app:identifier"/> | ||
<xsl:text> Name: </xsl:text> | ||
<xsl:value-of select="app:name"/> | ||
<xsl:text> Props: </xsl:text> | ||
<xsl:for-each select="app:prop1"> | ||
<xsl:value-of select="."/> | ||
<xsl:if test="position() != last()">, </xsl:if> | ||
</xsl:for-each> | ||
</li> | ||
</xsl:template> | ||
</xsl:stylesheet> |
32 changes: 32 additions & 0 deletions
32
...deegree-core-commons/src/test/resources/org/deegree/commons/xml/featureToHtml-Xslt20.xslt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0"?> | ||
<xsl:stylesheet version="2.0" | ||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
xmlns:app="http://deegree.org/app"> | ||
|
||
<xsl:output method="html" indent="yes"/> | ||
|
||
<xsl:template match="/"> | ||
<html lang="de"> | ||
<head/> | ||
<body> | ||
<h1>Ergebnis GFI</h1> | ||
<div> | ||
<ul> | ||
<xsl:for-each select="//app:Instance"> | ||
<xsl:apply-templates select="."/> | ||
</xsl:for-each> | ||
</ul> | ||
</div> | ||
</body> | ||
</html> | ||
</xsl:template> | ||
|
||
<xsl:template match="app:Instance"> | ||
<li> | ||
<xsl:text> </xsl:text> | ||
<xsl:value-of select="('Identifier:', app:identifier, 'Name:', app:name)" separator=" "/> | ||
<xsl:text> Props: </xsl:text> | ||
<xsl:value-of select="app:prop1" separator=", "/> | ||
</li> | ||
</xsl:template> | ||
</xsl:stylesheet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...esources/org/deegree/services/wms/controller/capabilities/serialize/capabilities2html.xsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...wms/src/test/resources/org/deegree/services/wms/controller/exceptions/exceptions2html.xsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why removing this specific xerces dependency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
xerces is used only in deegree-core-commons.