Code: 0xc00ce504
File: ......
Line: ...
Column: ...
A name was started with an invalid character.
The error refers to the '<' found in the string "<20" from my example xml file below (a).
Questions:
(1) Will a docbase/entity solution within my xslt script avoid the "invalid character" error while retaining the '<' in the output .TXT file?
(2) If so, could a forum member modify my example xslt script (b) with the required code?
(3) If neither of the above will work, does someone know how to code a .bat replace of '"<' with '"<' (I manually did this replacement and the msxsl call works fine but I'd like to automate this in .bat)?
Below is my project summary:
I have a very basic xml file with the sole element value containing a lot of text data (subset example for <TEST> values):
(a)
Expand|Select|Wrap|Line Numbers
- <?xml version="1.0"?>
- <TEST>
- "abcdefgh", "1"
- "abcdefgh", "1"
- "abcdefgh", "1"
- "abcdefgh", "1"
- "zzzzzz","yyyyy","xxxx","<20"
- "zzzzzz","yyyyy","xxxx","40"
- "zzzzzz","yyyyy","xxxx","<20"
- </TEST>
(note that I'm actually using some xpath function for another purpose but to be relevant to my questions above I added <xsl:value-of select="."> to the example below)
(b)
Expand|Select|Wrap|Line Numbers
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:output method="text" encoding="US-ASCII"/>
- <xsl:template match="@*|node()">
- <xsl:copy>
- <xsl:apply-templates select="@*|node()"/>
- </xsl:copy>
- </xsl:template>
- <xsl:template match="TEST">
- <xsl:copy-of select="@*"/>
- <xsl:value-of select="."></xsl:value-of>
- <xsl:apply-templates select="*"/>
- </xsl:template>
- </xsl:stylesheet>
(c)
Expand|Select|Wrap|Line Numbers
- ------begin .bat-----
- for /D %%k in ( C:\test\z\* ) do call :build %%~nk
- :build
- set _dr=%1
- for %%y in ( C:\test\z\*.xml ) do call :build2 %%y
- goto :eof
- :build2
- set _file2=%~pnx1
- set _outputtxt=%~pn1.txt
- msxsl %_file2% TEST.xslt -o %_outputtxt%
- :eof
- ------end .bat-----
h_q