|
Subject: Re: [xsl] spacing issue From: Spencer Tickner <spencertickner@xxxxxxxxx> Date: Fri, 3 Jun 2005 15:39:44 -0700 |
Ok, I was wrong,
When I looked at it by right clicking on the xml file and viewing it
in a browser it does look fine. The problem comes in when I run it
through Saxon.net and create the html file. Once again the spacing is
right out. I will post my exact templates involved below:
<!-- subsection -->
<xsl:template match="subsection" mode="contentsection">
<xsl:choose>
<xsl:when test="parent::section/sectiontext">
<p class="sub">(<xsl:apply-templates
select="subsectionnumber"/>)  <xsl:apply-templates
select="subsectiontext"/></p>
</xsl:when>
<xsl:otherwise>
<xsl:if test="not(count(preceding-sibling::*[name()=name(current())])+1
= 1)">
<p class="sub">(<xsl:apply-templates
select="subsectionnumber"/>)  <xsl:apply-templates
select="subsectiontext"/></p>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--subsectionnumber -->
<xsl:template match="subsectionnumber">
<xsl:apply-templates
select="text()|strong|a|graphic|em|sup|sub|u|insert|br|eacute|hr"/>
</xsl:template>
<!--subsectiontext -->
<xsl:template match="subsectiontext">
<xsl:apply-templates
select="text()|strong|a|graphic|em|sup|sub|u|insert|br|eacute|hr"/>
</xsl:template>
<!--insert -->
<xsl:template match="insert"><xsl:element name="{name()}"><xsl:element
name="span"><xsl:attribute
name="class">insert</xsl:attribute><xsl:apply-templates/></xsl:element></xsl:
element></xsl:template>
Hope that's enough of an example,xml is the same as posted above.
Wether you can see it in the email or not I placed the entire template
for <insert> on one line, to no avail.
Cheers,
Spencer
On 6/3/05, Spencer Tickner <spencertickner@xxxxxxxxx> wrote:
> Hi david,
>
> Thanks, that worked great. Sorry about the xml example. I think in my
> haste I tried to oversimplify it,, plus the fact that's it's friday
> and I'm starting to feel my brain ooze out my ear. The real code is
> more lik.
>
> :
> :
> :
> <section>
> <sectionnumber>2</sectionnumber>
> <sectiontext>The Section text</sectiontext>
> </section>
>
> and the templates more like
>
> :
> :
> <xsl:template match="root">
> :
> :
> <xsl:apply-templates mode="something"/>
> :
> :
> </xsl:template>
>
> <xsl:template match="section" mode="something">
> <!-- This is where I perform all my template calls for those involved
> in the section -->
> </xsl:template>
>
>
> Anyway, it works now either way so thanks for your time and patience.
>
> Spencer
>
> On 6/3/05, David Carlisle <davidc@xxxxxxxxx> wrote:
> >
> > If you have xsl:output indent="yes" (or are using the html output
> > method) change to indent="no". If that is not the cause of the white
> > space then the space is inserted by your stylesheet or copied from the
> > source, but as you haven't shown the templat ethat generates
> >
> > > <p class="para">(...
> >
> > It's not possible to really say what to change.
> >
> > If the space is being added by the html output method in places that
> > affect the rendering then that is a bug in the xslt system (which
> > putting xsl:output indent="no" would work around.
> >
> > Something is very odd about your input: you have
> > <xsl:template match="/">
> > <p class="sub">(<xsl:apply-templates
> > select="subsectionnumber"/>)  <xsl:apply-templates
> > select="subsectiontext"/></p>
> > </xsl:template>
> >
> >
> > which means your input has two child elements of the root node, so it is
> > not a well formed XML document. How are you supplying this XML fragment
> > to the processor?
> >
> >
> > David
> >
> > ________________________________________________________________________
> > This e-mail has been scanned for all viruses by Star. The
> > service is powered by MessageLabs. For more information on a proactive
> > anti-virus service working around the clock, around the globe, visit:
> > http://www.star.net.uk
> > ________________________________________________________________________
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] spacing issue, Spencer Tickner | Thread | RE: [xsl] spacing issue, Michael Kay |
| Re: [xsl] spacing issue, Spencer Tickner | Date | RE: [xsl] Saxon for windows?, Pieter Reint Siegers |
| Month |