Mathieu Malaterre wrote:
On 9/27/07, Abel Braaksma <abel(_dot_)online(_at_)xs4all(_dot_)nl> wrote:
Maybe I totally misunderstood your question, but if I did, please
respond with a tiny example of what you are after: a small but working
xslt document, a small input and a small output xml document, plus an
extra output xml containing what you want different. You know, with xml
it is like with pictures: one xml says more than a thousand words, but
thousand xmls (or very large ones) say nothing. ;)
Hi Abel,
Thanks again for your help. I think I have rewritten what happen in
a shorter example:
http://gdcm.svn.sourceforge.net/viewvc/gdcm/Sandbox/xslt/ws.xml
and
http://gdcm.svn.sourceforge.net/viewvc/gdcm/Sandbox/xslt/ws.xsl
Could you please let me know how to fix the following:
Thanks for the shorter samples, that sure helps a lot. But I still
prefer them in the mail, though (link vanish with time).
I don't see how you applied my changes.. This is your stylesheet:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<xsl:template match="@*">
<xsl:attribute name="{name()}" select="normalize-space(.)"/>
</xsl:template>
<xsl:template match="text()">
<xsl:value-of select="normalize-space(.)"/>
</xsl:template>
<xsl:template match="/">
<xsl:apply-templates select="*"/>
</xsl:template>
<xsl:template match="table">
<table>
<xsl:apply-templates/>
</table>
</xsl:template>
<xsl:template match="entry/para">
<entry ie="{.}"/>
</xsl:template>
</xsl:stylesheet>
I suggested to use a variable, like so:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<!-- whitespace correction templates -->
<xsl:template match="@*" mode="correct-ws">
<xsl:attribute name="{name()}" select="normalize-space(.)"/>
</xsl:template>
<xsl:template match="text()" mode="correct-ws">
<xsl:value-of select="normalize-space(.)"/>
</xsl:template>
<xsl:template match="/" mode="correct-ws">
<xsl:variable name="output">
<xsl:apply-templates select="*"/>
</xsl:variable>
<xsl:apply-templates select="$output/*" mode="correct-ws" />
</xsl:template>
<!-- normal templates -->
<xsl:template match="table">
<table>
<xsl:apply-templates/>
</table>
</xsl:template>
<xsl:template match="entry/para">
<entry ie="{.}"/>
</xsl:template>
</xsl:stylesheet>
That should do it. I didn't test it though ;)
Cheers,
-- Abel Braaksma
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--