Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8842115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:53:05+00:00 2026-06-14T10:53:05+00:00

Below is the XML file that is used as a source: <?xml version=1.0 encoding=UTF-8

  • 0

Below is the XML file that is used as a source:

<?xml version="1.0" encoding="UTF-8" ?>
<billing-log>
  <log-start-date>2012-08-17T00:00:00-05:00</log-start-date>
  <player-name>Player1</player-name>
  <schema-version>1</schema-version>
  <player-uuid>12345</player-uuid>
  <log-end-date>2012-08-17T23:59:59.999-05:00</log-end-date>
  <entry>
     <page>Page1</page>
     <path>Path1</path>
     <in>2012-08-16T23:59:52.170-05:00</in>
     <out>2012-08-17T00:00:00.186-05:00</out>
  </entry>
  <entry>
     <page>Page2</page>
     <path>Path2</path>
     <in>2012-08-17T00:00:00.186-05:00</in>
     <out>2012-08-17T00:00:08.561-05:00</out>
  </entry>
</billing-log>

The xsl file I am using is this:

<?xml version="1.0"?>
<xsl:stylesheet version = "1.0" xmlns:xsl = "http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
    <xsl:template match="log-start-date"></xsl:template>
    <xsl:template match="player-name"></xsl:template>
    <xsl:template match="schema-version"></xsl:template>
    <xsl:template match="player-uuid"></xsl:template>
    <xsl:template match="log-end-date"></xsl:template>
    <xsl:template match="//entry">
        <xsl:text>"</xsl:text>
        <xsl:value-of select="normalize-space(page)"/><xsl:text/>
        <xsl:text>","</xsl:text>
        <xsl:value-of select="normalize-space(path)"/><xsl:text/>
        <xsl:text>","</xsl:text>
        <xsl:value-of select="normalize-space(in)"/><xsl:text/>
        <xsl:text>","</xsl:text>
        <xsl:value-of select="normalize-space(out)"/><xsl:text/>
        <xsl:text>"&#10;&#13;</xsl:text>
<xsl:text disable-output-escaping = "yes" >
</xsl:text>
</xsl:template>
</xsl:stylesheet>

I feed these into the following c# console application to convert it into a CSV and write it out to a file.:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Xml;
using System.Xml.Xsl;

namespace xml2csv
{
    class Program
    {
        static int Main(string[] args)
        {
            if (args.Length != 3)
            {
                System.Console.WriteLine("Wrong number of aruguments");
                return -1;
            }

            string xmlFile = args[0];
            string xslFile = args[1];
            string outputFile = args[2];

            //Create a new XML document and load the XML file
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(xmlFile);
            //Create an XSLT object and load the XSLT file            
            XslCompiledTransform xslTran = new XslCompiledTransform();
            xslTran.Load(xslFile);
            // This is for generating the output
            XmlTextWriter writer = new XmlTextWriter(outputFile, System.Text.Encoding.ASCII);
            //Apply the transformation and write disk
            xslTran.Transform(xmlDoc, null, writer);
            //Close the writer
            writer.Close();

            return 1;

        }
    }
}

The result it produces is:

"Page1","Path1","2012-08 16T23:59:52.170-05:00","2012-08-17T00:00:00.186-05:00"
"Page2","Path2","2012-08-17T00:00:00.186-05:00","2012-08-17T00:00:08.561-05:00"

What I want is to prepend the sibling node value for log-end-date to ever record for the entry node. So the output would look like this:

"2012-08-17T23:59:59.999-05:00","Page1","Path1","2012-08 16T23:59:52.170-05:00","2012-08-17T00:00:00.186-05:00"
"2012-08-17T23:59:59.999-05:00","Page2","Path2","2012-08-17T00:00:00.186-05:00","2012-08-17T00:00:08.561-05:00"

Any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T10:53:06+00:00Added an answer on June 14, 2026 at 10:53 am

    Just add:

    <xsl:value-of select="concat('&quot;',normalize-space(../log-end-date),'&quot;')"/>
    

    as the first child of your template for entry.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an xml file likes below. <?xml version=1.0 encoding=utf-8 ?> <Book> <Title>Title</Title> <Content>Content</Content>
I have a xml file as below: <?xml version=1.0 encoding=UTF-8 standalone=no?> <RULES> <RULE DESCRIPTION=
I'm traversing an xml file as below: <?xml version=1.0 encoding=ISO-8859-1?> <wrapper> <site base=http://www.example1.co.uk/ name=example
I auto generated an xsd file from the below xml and used xsd2code to
We have XML file like below... <?xml version='1.0'?> <T0020 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=http://www.safersys.org/namespaces/T0020V1 T0020V1.xsd xmlns=http://www.safersys.org/namespaces/T0020V1> <IRP_ACCOUNT>
I have a need to change the spring applicationContext.xml file that is used based
How to read the below xml file and write its content into a plain
How do I change my XML file below to have CAS return to the
I already implemented to create the XML file below with XmlTextWriter when application initialization.
I setup a logging.xml file as shown below. This file includes output to the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.