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 { ...@@ -225,7 +225,7 @@ public XsltTransformer getTransformer() throws SaxonApiException, IOException {
css.get())); css.get()));
} }
transformer.setParameter(new QName("embedded"), new XdmAtomicValue( transformer.setParameter(new QName("embedded"), new XdmAtomicValue(
embedded)); embedded || simulate));
if (id.isPresent()) if (id.isPresent())
transformer.setParameter(new QName("ID"), new XdmAtomicValue(id.get())); transformer.setParameter(new QName("ID"), new XdmAtomicValue(id.get()));
...@@ -251,10 +251,12 @@ public void write(final OutputStream out) throws IOException, ...@@ -251,10 +251,12 @@ public void write(final OutputStream out) throws IOException,
if (simulate) { if (simulate) {
final XsltTransformer frame = stylesheetManager.getStylesheet(SIMULATE_XSL, getSid(), false, true).load(); final XsltTransformer frame = stylesheetManager.getStylesheet(SIMULATE_XSL, getSid(), false, true).load();
frame.setDestination(serializer); frame.setDestination(serializer);
frame.setParameter(new QName("extraclass"), new XdmAtomicValue(getRootObjects()[0].getGeneric().getGenerated().getProject().getId()));
getTransformer().setDestination(frame); getTransformer().setDestination(frame);
} else if (embedded) { } else if (embedded) {
final XsltTransformer extractBody = stylesheetManager.getStylesheet(EXTRACT_BODY_XSL, getSid(), false, true).load(); final XsltTransformer extractBody = stylesheetManager.getStylesheet(EXTRACT_BODY_XSL, getSid(), false, true).load();
extractBody.setDestination(serializer); extractBody.setDestination(serializer);
extractBody.setParameter(new QName("extraclass"), new XdmAtomicValue(getRootObjects()[0].getGeneric().getGenerated().getProject().getId()));
getTransformer().setDestination(extractBody); getTransformer().setDestination(extractBody);
} else { } else {
getTransformer().setDestination(serializer); getTransformer().setDestination(serializer);
......
...@@ -12,11 +12,13 @@ ...@@ -12,11 +12,13 @@
--> -->
<xsl:output method="xhtml" omit-xml-declaration="yes"/> <xsl:output method="xhtml" omit-xml-declaration="yes"/>
<xsl:param name="extraclass"/>
<xsl:template match="/"> <xsl:template match="/">
<xsl:choose> <xsl:choose>
<xsl:when test="//body"> <xsl:when test="//body">
<div class="body"> <div class="body {$extraclass}">
<xsl:copy-of select="//body/*"/> <xsl:copy-of select="//body/*"/>
</div> </div>
</xsl:when> </xsl:when>
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<xsl:output method="xhtml" /> <xsl:output method="xhtml" />
<xsl:param name="repurl">http://textgridrep.de</xsl:param> <xsl:param name="repurl">http://textgridrep.de</xsl:param>
<xsl:param name="extraclass"/>
<xsl:template match="/"> <xsl:template match="/">
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ --> <!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
...@@ -162,7 +163,7 @@ ...@@ -162,7 +163,7 @@
<xsl:template name="process-tei"> <xsl:template name="process-tei">
<xsl:choose> <xsl:choose>
<xsl:when test="//body"> <xsl:when test="//body">
<div class="body"> <div class="body {$extraclass}">
<xsl:copy-of select="//body/*"/> <xsl:copy-of select="//body/*"/>
</div> </div>
</xsl:when> </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