whitespace

OK, am going back to trying to solve the whitespace problem. This seems
to touch on a number of issues, so let me see what people think.

Let’s look at an example template:

<xsl:template match=“mods:originInfo”>
<xsl:param name=“prefix”/>
<xsl:param name=“suffix”/>
<xsl:if test=“mods:place”>

<xsl:value-of select="$prefix"/>
<xsl:apply-templates select=“mods:place”/>
<xsl:apply-templates select=“mods:publisher”/>
<xsl:value-of select="$suffix"/>

</xsl:if>
</xsl:template>

This is transforming MODS content into an intermediate representation.
The problem is that the prefix and suffix content is placed outside the
wrapper element, so that the result (internally) would be something like:

, <bib:span class=“origin”>whatever</bib:span>,

This is what causes the whitespace problem, because whitespace only gets
preserved within the bib:span element.

OK, so in theory I could instead do:

<bib:span class=“origin”>, whatever, </bib:span>

That solves the whitespace issue, but probably introduces side-effects.
For example, if you assign special font formatting (bold, italic,
etc.) to that content, does that apply to both the prefix and suffix
content AND the actual element content, or just the latter? If the
latter, then perhaps that suggests the need for:

<bib:span class=“origin”>, bib:contentwhatever</bib:content>, </bib:span>

And then what about XML output?

Thoughts?

Bruce

I’m far from sure that I understand …

The prefix is ", " and the suffix ", " right?

OK, am going back to trying to solve the whitespace problem. This
seems to touch on a number of issues, so let me see what people think.

Let’s look at an example template:

<xsl:template match=“mods:originInfo”>
<xsl:param name=“prefix”/>
<xsl:param name=“suffix”/>
<xsl:if test=“mods:place”>

<xsl:value-of select=“$prefix”/>
<xsl:apply-templates select=“mods:place”/>
<xsl:apply-templates select=“mods:publisher”/>
<xsl:value-of select=“$suffix”/>

</xsl:if>
</xsl:template>

This is transforming MODS content into an intermediate representation.
The problem is that the prefix and suffix content is placed outside
the wrapper element, so that the result (internally) would be
something like:

, <bib:span class=“origin”>whatever</bib:span>,

From the code above it looks to me like the prefix and suffix are
inside the span but when you write it here they are outside. Why?

This is what causes the whitespace problem, because whitespace only
gets preserved within the bib:span element.

OK, so in theory I could instead do:

<bib:span class=“origin”>, whatever, </bib:span>

That solves the whitespace issue, but probably introduces
side-effects. For example, if you assign special font formatting
(bold, italic, etc.) to that content, does that apply to both the
prefix and suffix content AND the actual element content, or just the
latter? If the latter, then perhaps that suggests the need for:

<bib:span class=“origin”>, bib:contentwhatever</bib:content>,
</bib:span>

I like this more because it seems to allow more formating options
later. ie as a general principle we should, I think, preserve as much
semantic metadata for as long as possible, deferring formatting (eg
blod) for as long as possible (eg here it would be in the css style,
right?)

And then what about XML output?

I don’t understand the question I’m afraid.

–James
+1 315 395 4056
Details: <http://freelancepropaganda.com/jameshowison.vcf

From the code above it looks to me like the prefix and suffix are
inside the span but when you write it here they are outside. Why?

Just seeing if you’re paying attention.

Actually, it was just a mistake.

And then what about XML output?

I don’t understand the question I’m afraid.

For example, XHTML (or OpenOffice); do you want:

, Some Title,

… or:

, Some Title,

or something else?

Bruce

From the code above it looks to me like the prefix and suffix are
inside the span but when you write it here they are outside. Why?

Just seeing if you’re paying attention.

Actually, it was just a mistake.

:slight_smile:

And then what about XML output?

I don’t understand the question I’m afraid.

For example, XHTML (or OpenOffice); do you want:

, Some Title,

… or:

, Some Title,

The first, I think, because there’s more semantic information
retained. The trade off is more complicated code and style sheets but
that is what machines are for.

Commas are perhaps not a great example of a prefix and suffix that
you’d want to transform, but if it was brackets or even words, you
definitely would want to transform those too.

–James
+1 315 395 4056
Details: <http://freelancepropaganda.com/jameshowison.vcf

, Some Title,

… or:

, Some Title,

The first, I think, because there’s more semantic information
retained. The trade off is more complicated code and style sheets but
that is what machines are for.

There are other tradeoffs too. For example, do we understand CSS
styling information to only apply to the metadata content, or to the
prefix and suffix too? Or to make things even more of a complicated
PITA, do we have to contemplate allowing separate styling for the
prefix and suffix elements as well? I sure hope not!

Commas are perhaps not a great example of a prefix and suffix that
you’d want to transform, but if it was brackets or even words, you
definitely would want to transform those too.

The wrapping is partly to have semantic content to grab onto for
formatting, but it’s also to better control whitespace (which is
critical for this stuff).

Bruce