- markup (76)
- xml (11)
- xslt (23)
- pipelines (8)
- atom (9)
- overlapping markup (6)
- schema (11)
- creole (5)
- dtll (1)
- xforms (1)
- xpath (1)
- xquery (2)
- coding (2)
- datagovuk (1)
- genealogy (4)
- hardware (1)
- linked data (15)
- named graphs (1)
- opendata (1)
- psi (3)
- skos (1)
- sparql (4)
- Talis (7)
- unicode (1)
- uri (4)
- versioning (1)
- visualisation (6)
- web (77)
- google (4)
- html5 (5)
- jQuery (2)
- rdf (45)
- ontologies (2)
- rdfa (8)
- rdfQuery (5)
- rest (6)
- wikis (1)
- work (3)
- legislation (2)
- xmlsummerschool09 (2)
- life (28)
- children (5)
- equality (6)
- gtd (1)
- environment (4)
- gadgets (5)
- software (3)
- xlinq (2)
- conferences (11)
- ukgc09 (1)
- xtech (9)
- xtech2008 (3)
- blog (8)
- 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.