Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 5th, 2007, 03:27 AM
Registered User
 
Join Date: Apr 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Creating XSLT file (C#)

Hi All,

Could anybody tell me how to create a XSLT file using C#?

Below is the sample XLST file.

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:fox="http://xml.apache.org/fop/extensions" xmlns:foa="http://fabio">
  <xsl:import href="exampleAtts.xsl"></xsl:import>
  <xsl:output method="xml" encoding="UTF-8"></xsl:output>
  <xsl:variable name="dots">l</xsl:variable>
  <xsl:variable name="circles">m</xsl:variable>
  <xsl:variable name="squares">n</xsl:variable>
  <xsl:template match="/">
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
      <fo:layout-master-set>
        <fo:simple-page-master master-name="FirstPage">
          <fo:region-body ></fo:region-body >
        </fo:simple-page-master>
        <fo:page-sequence-master master-name="ExampleSequence">
          <fo:single-page-master-reference master-name="FirstPage"/>
        </fo:page-sequence-master>
      </fo:layout-master-set>
      <fo:page-sequence master-name="ExampleSequence">
        <fo:flow flow-name="xsl-region-body">
          <xsl:apply-templates select="document('document.xml')/mydocument"/>
        </fo:flow >
      </fo:page-sequence >
    </fo:root>
  </xsl:template>
  <xsl:template match="mydocument/paragraph" foa:name="HelloParagraph" foa:class="block" foa:group="paragraph">
    <fo:block foa:name="HelloParagraph" foa:group="paragraph" xsl:use-attribute-sets="StandardParagraph">
      <xsl:apply-templates/>
    </fo:block>
  </xsl:template>
</xsl:stylesheet>

Cheers,
Arul.


 
Old April 5th, 2007, 08:02 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

What do you mean by your question? It looks like you already have a XSLT.

-Peter
 
Old April 5th, 2007, 08:06 AM
Registered User
 
Join Date: Apr 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I want to create an XSL file which has to look like this.

But I dont know how to add xsl/fo as prefix to elements.

Cheers,
Arul.

 
Old April 5th, 2007, 10:08 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

An XSLT document is just XML. You can construct an XML document with the XmlDocument or XmlTextWriter class (maybe more). You just have to provide the right node names and prefixes to make them "xsl" specific.

One thing you could try, is load an existing XSL document into the XmlDocument class and look at the node structure and properties that exist in the class (if you are using Visual Studio, you could just look at the XmlDocument in a debug window and browse around at the various properties). This would give you a good idea how you would programmatically construct a similar document.

-Peter





Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating Excel File vikas67k C# 6 March 4th, 2010 05:02 AM
creating xslt from dataset in .net sudhir164 .NET Framework 2.0 2 December 4th, 2007 12:16 AM
creating a subset of xml schema using XSLT kapar_p XSLT 8 November 21st, 2006 09:46 AM
XSLT problem w/ creating JavaScript (FCKeditor) dornad XSLT 0 June 27th, 2006 03:53 PM
Creating help file Amitava Deewan Beginning VB 6 0 February 7th, 2006 10:47 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.