Commit d717edcc authored by thorsten.vitt's avatar thorsten.vitt
Browse files

Project specific class in embedded and simulated views

The root div for the TEI content in the HTML generated using
?embedded=true or ?simulate=true now contains an additional class that
is simply the group ID to allow project-specific body styling.
parent 428df161
......@@ -225,7 +225,7 @@ public XsltTransformer getTransformer() throws SaxonApiException, IOException {
css.get()));
}
transformer.setParameter(new QName("embedded"), new XdmAtomicValue(
embedded));
embedded || simulate));
if (id.isPresent())
transformer.setParameter(new QName("ID"), new XdmAtomicValue(id.get()));
......@@ -251,10 +251,12 @@ public void write(final OutputStream out) throws IOException,
if (simulate) {
final XsltTransformer frame = stylesheetManager.getStylesheet(SIMULATE_XSL, getSid(), false, true).load();
frame.setDestination(serializer);
frame.setParameter(new QName("extraclass"), new XdmAtomicValue(getRootObjects()[0].getGeneric().getGenerated().getProject().getId()));
getTransformer().setDestination(frame);
} else if (embedded) {
final XsltTransformer extractBody = stylesheetManager.getStylesheet(EXTRACT_BODY_XSL, getSid(), false, true).load();
extractBody.setDestination(serializer);
extractBody.setParameter(new QName("extraclass"), new XdmAtomicValue(getRootObjects()[0].getGeneric().getGenerated().getProject().getId()));
getTransformer().setDestination(extractBody);
} else {
getTransformer().setDestination(serializer);
......
......@@ -12,11 +12,13 @@
-->
<xsl:output method="xhtml" omit-xml-declaration="yes"/>
<xsl:param name="extraclass"/>
<xsl:template match="/">
<xsl:choose>
<xsl:when test="//body">
<div class="body">
<div class="body {$extraclass}">
<xsl:copy-of select="//body/*"/>
</div>
</xsl:when>
......
......@@ -12,6 +12,7 @@
<xsl:output method="xhtml" />
<xsl:param name="repurl">http://textgridrep.de</xsl:param>
<xsl:param name="extraclass"/>
<xsl:template match="/">
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
......@@ -162,7 +163,7 @@
<xsl:template name="process-tei">
<xsl:choose>
<xsl:when test="//body">
<div class="body">
<div class="body {$extraclass}">
<xsl:copy-of select="//body/*"/>
</div>
</xsl:when>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment