Saturday 15 June 2013

c# - xslt transform in .net without any input document from code -


To draw input xml I want to use the document function of XSLT because I have to parse several input XML files But there is no method to implement the conversion of the XslCompiledTransform class without explicitly specifying the input xml. I was seeking a response from the gurus here, otherwise I would have to do it incorrectly.

If an XSLT stylesheet ignores its input, you can supply any XML document Which you like as input. (You have to specify some input, because the XSLT processing model receives some input.)

One way to put an XML document where it can be referenced, with this type of content:

  & lt; Dummy & gt; This is an XML document which is used as a dummy input on the stylesheet - input.exl Do not delete it! & Lt; / Dummy & gt;   

Another slightly more elegant approach I know is favored among XSLT programmers; Sometimes the subsequent maintenance programmer has the added advantage of a complete decomposition in those who have not seen the idioms before (so use it carefully if the maintenance programmer is where you live). Specify the XSLT stylesheet as an input document The XSLT stylesheet must already be visible in the code applied for conversion, and it is an XML document, so it satisfies the requirements without the need to create a new dummy XML document.

No comments:

Post a Comment