Click here to Skip to main content
14,920,714 members
Home / Discussions / XML / XSL
   

XML / XSL

 
GeneralRe: Different XSD representation of an element. Pin
Comp_Users13-Jul-09 0:54
MemberComp_Users13-Jul-09 0:54 
Questionhow to use select result in another select [modified] Pin
daveyerwin9-Jul-09 4:19
Memberdaveyerwin9-Jul-09 4:19 
AnswerRe: how to use select result in another select Pin
Jeremy Likness9-Jul-09 7:40
professionalJeremy Likness9-Jul-09 7:40 
GeneralRe: how to use select result in another select Pin
daveyerwin9-Jul-09 9:02
Memberdaveyerwin9-Jul-09 9:02 
AnswerRe: how to use select result in another select Pin
Stuart Dootson9-Jul-09 13:03
professionalStuart Dootson9-Jul-09 13:03 
QuestionGenerating multiple files using XSLT 1.0 Pin
Fadi Yoosuf8-Jul-09 5:33
MemberFadi Yoosuf8-Jul-09 5:33 
AnswerRe: Generating multiple files using XSLT 1.0 Pin
Stuart Dootson8-Jul-09 7:27
professionalStuart Dootson8-Jul-09 7:27 
GeneralRe: Generating multiple files using XSLT 1.0 Pin
Fadi Yoosuf8-Jul-09 20:40
MemberFadi Yoosuf8-Jul-09 20:40 
Thank you Stuart

But can you clarify some more things?

My xml file is
<?xml version="1.0" encoding="utf-8" ?>
<bookstore>
  <book genre="autobiography" publicationdate="1981" ISBN="1-861003-11-0">
    <title>The Autobiography of Benjamin Franklin</title>
    <author>
      <first-name>Benjamin</first-name>
      <last-name>Franklin</last-name>
    </author>
    <price>8.99</price>
  </book>
  <book genre="novel" publicationdate="1967" ISBN="0-201-63361-2">
    <title>The Confidence Man</title>
    <author>
      <first-name>Herman</first-name>
      <last-name>Melville</last-name>
    </author>
    <price>11.99</price>
  </book>
  <book genre="philosophy" publicationdate="1991" ISBN="1-861001-57-6">
    <title>The Gorgias</title>
    <author>
      <name>Plato</name>
    </author>
    <price>9.99</price>
  </book>
</bookstore>



My xslt file is
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:output="urn:output">

  <xsl:template match="bookstore">
    <bookstore>
      <xsl:for-each select="book">
        <book>
          <xsl:copy-of select="node()"/>
          <new-price>
            <xsl:value-of select="output:SaveOutput(@genre, node())"/>
          </new-price>
        </book>
      </xsl:for-each>
    </bookstore>
  </xsl:template>
</xsl:stylesheet>



C# code goes like
private void ExtensionTest()
{
            XslCompiledTransform xslt = new XslCompiledTransform();
            xslt.Load("extension.xslt");
            XsltArgumentList xslArg = new XsltArgumentList();

            OutputSaver obj = new OutputSaver();
            xslArg.AddExtensionObject("urn:output", obj);
            using (XmlWriter w = XmlWriter.Create("output.xml"))
            {
                xslt.Transform("books.xml", xslArg, w);
            }
}
 public class OutputSaver
 {
        public void SaveOutput(string fileName, string node)
        {
            StreamWriter s = new StreamWriter(fileName);
            s.Write(node);
            s.Flush();
        }
 }


Now I have 2 issues
* How to pass the xslt node content to SaveOutput method in c#
* How avoid specifying an output file in Trnasform method of XslCompiledTransform (This is to avoid generating an addtional file with the files generated using extennsion method)

Thank you
Fadi
GeneralRe: Generating multiple files using XSLT 1.0 Pin
Fadi Yoosuf8-Jul-09 20:45
MemberFadi Yoosuf8-Jul-09 20:45 
GeneralRe: Generating multiple files using XSLT 1.0 Pin
Stuart Dootson9-Jul-09 0:23
professionalStuart Dootson9-Jul-09 0:23 
QuestionXSL Sort Pin
bbm2k35-Jul-09 9:31
Memberbbm2k35-Jul-09 9:31 
AnswerRe: XSL Sort Pin
Stuart Dootson5-Jul-09 11:51
professionalStuart Dootson5-Jul-09 11:51 
QuestionRss Implemetation Pin
ksss_maheshece3-Jul-09 2:05
Memberksss_maheshece3-Jul-09 2:05 
AnswerRe: Rss Implemetation Pin
DoctorMick3-Jul-09 2:41
MemberDoctorMick3-Jul-09 2:41 
GeneralRe: Rss Implemetation [modified] Pin
ksss_maheshece3-Jul-09 2:55
Memberksss_maheshece3-Jul-09 2:55 
GeneralRe: Rss Implemetation Pin
Stuart Dootson3-Jul-09 3:44
professionalStuart Dootson3-Jul-09 3:44 
AnswerRe: Rss Implemetation Pin
K03063-Jul-09 18:53
MemberK03063-Jul-09 18:53 
GeneralRe: Rss Implemetation Pin
ksss_maheshece3-Jul-09 21:50
Memberksss_maheshece3-Jul-09 21:50 
Questiondesktop news ticker Pin
dahras2-Jul-09 8:43
Memberdahras2-Jul-09 8:43 
QuestionRunning an exe file Pin
Bram van Kampen1-Jul-09 14:52
MemberBram van Kampen1-Jul-09 14:52 
AnswerRe: Running an exe file Pin
Stuart Dootson1-Jul-09 21:26
professionalStuart Dootson1-Jul-09 21:26 
GeneralRe: Running an exe file Pin
Bram van Kampen1-Jul-09 22:30
MemberBram van Kampen1-Jul-09 22:30 
QuestionEmpty value is passed while reading value from an XML node Pin
Mahesh.J29-Jun-09 19:11
MemberMahesh.J29-Jun-09 19:11 
AnswerRe: Empty value is passed while reading value from an XML node Pin
Stuart Dootson29-Jun-09 22:20
professionalStuart Dootson29-Jun-09 22:20 
GeneralRe: Empty value is passed while reading value from an XML node Pin
Mahesh.J29-Jun-09 23:05
MemberMahesh.J29-Jun-09 23:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.