Library Version 12.1.3.0

Customizing the Default XSLT File
Prev | Chapter 9. SPARQL Gateway for XML-based Tools | Next

## Customizing the Default XSLT File

You can customize the default XSL transformation file (the one referenced using `wx=default.xslt`). This section presents some examples of customizations.

The following example implements this namespace prefix replacement logic: if a variable binding returns a URI that starts with http://purl.org/goodrelations/v1#, that portion is replaced by gr:; and if a variable binding returns a URI that starts with http://www.w3.org/2000/01/rdf-schema#, that portion is replaced by rdfs:.

    <xsl:when test="starts-with(text(),
    'http://purl.org/goodrelations/v1#')">
    <xsl:value-of select="concat('gr:',substring-after(text(),
    'http://purl.org/goodrelations/v1#'))"/>
    </xsl:when>
    ...
    <xsl:when test="starts-with(text(),
                             'http://www.w3.org/2000/01/rdf-schema#')">
       <xsl:value-of select="concat('rdfs:',substring-after(text(),
    'http://www.w3.org/2000/01/rdf-schema#'))"/>
    </xsl:when>
    The following example implements logic to trim a leading http://localhost/
    or a leading http://127.0.0.1/.
    <xsl:when test="starts-with(text(),'http://localhost/')">
      <xsl:value-of select="substring-after(text(),'http://localhost/')"/>
    </xsl:when>
    <xsl:when test="starts-with(text(),'http://127.0.0.1/')">
      <xsl:value-of select="substring-after(text(),'http://127.0.0.1/')"/>
    </xsl:when>

Prev | Up | Next
Using SPARQL Gateway with RDF Data | Home | Using the SPARQL Gateway Graphical Web Interface