I'm trying to produce multiple xml files using xslt from one input. its working very well with the batch file but not working in the C# -
uri schemauri = new uri(folder+"\\xmloutput.xml"); uri xsluri = new uri(folder+"\\splitstory.xslt"); processor processor = new processor(); xdmnode input = processor.newdocumentbuilder().build(schemauri); xslttransformer transformer = processor.newxsltcompiler().compile(xsluri).load(); transformer.initialcontextnode = input; // baseoutputuri necessary xsl:result-document. transformer.baseoutputuri = xsluri; serializer serializer = new serializer(); //var _file = file.create(folder+"\\1.xml"); //serializer.setoutputstream(_file); //serializer.setoutputfile(folder + "\\1.xml"); transformer.run(serializer); // _file.close();
this code i'm using conversion.
<xs:output method="xml" name="xml" standalone="yes" indent="yes"/> <xs:preserve-space elements="text"/> <xs:template match="node()|@*"> <xs:copy> <xs:apply-templates select="node()|@*"/> </xs:copy> </xs:template> <xs:template match="story"> <xs:variable name="self" select="child::story/@self"/> <xs:variable name="m" select="concat('story_',$self,'.xml')"/> <xs:variable name="filename" select="concat('output/',$m)"/> <xs:result-document href="{$filename}" format="xml" method="text"> <xs:copy> <xs:apply-templates select="@*|node()"/> </xs:copy> </xs:result-document> </xs:template>
this xslt i'm using. i've tried method="text" in result-document it's not working
yes i'm using .net version of saxon 9.5 enterprise edition. it's not giving error. asking "output\" right, produce output xmls inside output folder. it's working fine combination of saxon jar , batch. saying not working meant n number of output xmls not able produce using c# code i'd mentioned. c# code processing other xslts doesn't have result-document , giving correct output. i've seen in 1 of these threads using 'method="text"' may solve problem, that's why tried it.
Comments
Post a Comment