- markup (52)
- xml (7)
- xslt (21)
- atom (8)
- overlapping markup (2)
- schema (9)
- creole (4)
- xforms (1)
- pipelines (7)
- coding (2)
- dtll (1)
- genealogy (3)
- gtd (1)
- hardware (1)
- legislation (1)
- ontologies (2)
- unicode (1)
- web (24)
- google (3)
- rdf (6)
- rest (3)
- wikis (1)
- work (1)
- xpath (1)
- xquery (1)
- xtech2008 (3)
- life (26)
- children (5)
- equality (6)
- environment (4)
- gadgets (5)
- software (3)
- xlinq (2)
- conferences (7)
- xtech (6)
- blog (7)
- drupal (3)
Re: Things that make me scream: xml:space="preserve" in WordML
Hi Jeni, I’ve having a bit of a problem and don’t know if its xsl or VS.Net. I’m running a transform in .NET 2.0 and basically processing all elements and if it is a ‘special’ element I do something but if it is a ‘word element’ I basically just try to replicate it, but I can’t use a xsl:copy-of because I need to process its sub elements to see if there are any special elements. Anyway, when I come across something like this when I’ve pasted a big blob of WordML..
<w:t> </w:t>
I am using basically templates like this:
<xsl:template match=”” mode=”replace-merge-fields”> <xsl:element name=”{name()}”> <xsl:apply-templates select=”@ | node()” mode=”replace-merge-fields”/> </xsl:element> </xsl:template>
<xsl:template match=”@*” mode=”replace-merge-fields”> <xsl:attribute name=”{name()}”><xsl:value-of select=”.”/></xsl:attribute> </xsl:template>
<xsl:template match=”text()” mode=”replace-merge-fields”> <xsl:choose> <xsl:when test=”.=’«DBACC»’”> <xsl:text>TerryAney:DBACC</xsl:text> </xsl:when> <xsl:otherwise><xsl:value-of select=”.”/></xsl:otherwise> </xsl:choose> </xsl:template>
The problem is for that <w:t> </w:t> that would have put a space between some words is now converted to <w:t /> and I lose the space. Is this something that is .NET specific or xsl specific?
Any suggestions on how to preserve the actual open and close element would be greatly appreciated.