Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. How to create a semi-colon seperated file using XSL

How to create a semi-colon seperated file using XSL

Scheduled Pinned Locked Moved XML / XSL
xmltutorialwpfregexhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RK11 2009
    wrote on last edited by
    #1

    Hello, I have written a XSL which is to read the data from a DTO and write to a .CSV file with the following format. I am not able to create semi-colon values and also the padding format written is not being reflected in the output file. Can anyone help in incorporating these formats. I am attaching my XSL here for the reference. Thanks for the same. -The file created is an excel file. The extension is “.CSV”. -The data are separated by the character semi-colon “;”. -Every data row end up with an end of row character and a carriage return character (CR/LF). -The end of the file is marked by an empty record row. In other words, the last row only contain semi-colon characters and all the fields are empty. If the data length is inferior to the data maximum size, a padding is done as following: - the numeric data are filled with “0” (zero) on the left (for example 003) - the alphanumeric data are filled with empty spaces “ “ <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dft="http://MyProj.Dto.CustomerSpecificExport/"> <xsl:output method="text" indent="yes" /> <xsl:template match="/dft:ArrayOfExportDataDto"> <xsl:apply-templates select="dft:ExportDataDto"/> </xsl:template> <xsl:template match="dft:ExportDataDto"> - <xsl:call-template name="pad-right"> <xsl:with-param name="str" select="AgencyName" /> <xsl:with-param name="len" select="20" /> </xsl:call-template> - <xsl:call-template name="pad-right"> <xsl:with-param name="str" select="CandidateName" /> <xsl:with-param name="len" select="20" /> </xsl:call-template> - <xsl:call-template name="pad-right"> <xsl:with-param name="str" select="CandidateSurname" /> <xsl:with-param name="len" select="10" /> </xsl:call-template> - <xsl:call-template name="pad-right"> <xsl:with-param name="str" select="BeginDate" /> <xsl:with-param name="len" select="10" /> <xsl:with-param name="pad" select="0" /> </xsl:call-template> - <xsl:call-template name="pad-right"> <xsl:with-param name="str" select="InitialMissionEndDate" /> <xsl:with-param name="len" select="10" /> <xsl:with-param name="pad" select="0" /> </xsl:call-template> - <xsl:call-template name="pad-left"&

    S 1 Reply Last reply
    0
    • R RK11 2009

      Hello, I have written a XSL which is to read the data from a DTO and write to a .CSV file with the following format. I am not able to create semi-colon values and also the padding format written is not being reflected in the output file. Can anyone help in incorporating these formats. I am attaching my XSL here for the reference. Thanks for the same. -The file created is an excel file. The extension is “.CSV”. -The data are separated by the character semi-colon “;”. -Every data row end up with an end of row character and a carriage return character (CR/LF). -The end of the file is marked by an empty record row. In other words, the last row only contain semi-colon characters and all the fields are empty. If the data length is inferior to the data maximum size, a padding is done as following: - the numeric data are filled with “0” (zero) on the left (for example 003) - the alphanumeric data are filled with empty spaces “ “ <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dft="http://MyProj.Dto.CustomerSpecificExport/"> <xsl:output method="text" indent="yes" /> <xsl:template match="/dft:ArrayOfExportDataDto"> <xsl:apply-templates select="dft:ExportDataDto"/> </xsl:template> <xsl:template match="dft:ExportDataDto"> - <xsl:call-template name="pad-right"> <xsl:with-param name="str" select="AgencyName" /> <xsl:with-param name="len" select="20" /> </xsl:call-template> - <xsl:call-template name="pad-right"> <xsl:with-param name="str" select="CandidateName" /> <xsl:with-param name="len" select="20" /> </xsl:call-template> - <xsl:call-template name="pad-right"> <xsl:with-param name="str" select="CandidateSurname" /> <xsl:with-param name="len" select="10" /> </xsl:call-template> - <xsl:call-template name="pad-right"> <xsl:with-param name="str" select="BeginDate" /> <xsl:with-param name="len" select="10" /> <xsl:with-param name="pad" select="0" /> </xsl:call-template> - <xsl:call-template name="pad-right"> <xsl:with-param name="str" select="InitialMissionEndDate" /> <xsl:with-param name="len" select="10" /> <xsl:with-param name="pad" select="0" /> </xsl:call-template> - <xsl:call-template name="pad-left"&

      S Offline
      S Offline
      Stuart Dootson
      wrote on last edited by
      #2

      RK11@2009 wrote:

      I am not able to create semi-colon values

      I don't see you ever writing semi-colons or line separators to the output?

      Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups