Click here to Skip to main content
15,910,981 members
Home / Discussions / XML / XSL
   

XML / XSL

 
QuestionHow to load xml file in mozillla Pin
biswa4724-Aug-09 3:55
biswa4724-Aug-09 3:55 
AnswerRe: How to load xml file in mozillla Pin
Stuart Dootson24-Aug-09 23:33
professionalStuart Dootson24-Aug-09 23:33 
GeneralRe: How to load xml file in mozillla Pin
biswa4724-Aug-09 23:50
biswa4724-Aug-09 23:50 
GeneralRe: How to load xml file in mozillla Pin
Stuart Dootson24-Aug-09 23:52
professionalStuart Dootson24-Aug-09 23:52 
GeneralRe: How to load xml file in mozillla Pin
biswa4725-Aug-09 0:08
biswa4725-Aug-09 0:08 
GeneralRe: How to load xml file in mozillla Pin
Stuart Dootson25-Aug-09 1:13
professionalStuart Dootson25-Aug-09 1:13 
QuestionXML Save and Load to SQL Server 2005 Database. Pin
ashwath197924-Aug-09 1:56
ashwath197924-Aug-09 1:56 
QuestionHow to create a semi-colon seperated file using XSL Pin
RK11@200919-Aug-09 3:15
RK11@200919-Aug-09 3:15 
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">
<xsl:with-param name="str" select="AmendmentDate" />
<xsl:with-param name="len" select="10" />
<xsl:with-param name="pad" select="0" />
</xsl:call-template>
- <xsl:call-template name="pad-left">
<xsl:with-param name="str" select="LastAmendmentDate" />
<xsl:with-param name="len" select="10" />
<xsl:with-param name="pad" select="0" />
</xsl:call-template>
- <xsl:call-template name="pad-left">
<xsl:with-param name="str" select="ResortCaseCode" />
<xsl:with-param name="len" select="3" />
<xsl:with-param name="pad" select="0" />
</xsl:call-template>
- <xsl:call-template name="pad-left">
<xsl:with-param name="str" select="MaxEndDateofContract" />
<xsl:with-param name="len" select="10" />
<xsl:with-param name="pad" select="0" />
</xsl:call-template>
- <xsl:call-template name="pad-left">
<xsl:with-param name="str" select="MinEndDateofContract" />
<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="ModifVal" />
<xsl:with-param name="len" select="2" />
</xsl:call-template>
<xsl:text></xsl:text>
</xsl:template>
<xsl:template name="pad-left">
<xsl:param name="str"/>
<xsl:param name="len"/>
<xsl:param name="pad" select="' '"/>
<xsl:choose>
<xsl:when test="string-length($str) &gt; $len">
<xsl:value-of select="substring($str, 1, $len)"/>
</xsl:when>
<xsl:when test="string-length($str) &lt; $len">
<xsl:call-template name="pad-left">
<xsl:with-param name="str" select="concat($pad, $str)"/>
<xsl:with-param name="len" select="$len"/>
<xsl:with-param name="pad" select="$pad"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$str"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="pad-right">
<xsl:param name="str"/>
<xsl:param name="len"/>
<xsl:param name="pad" select="' '"/>
<xsl:choose>
<xsl:when test="string-length($str) &gt; $len">
<xsl:value-of select="substring($str, 1, $len)"/>
</xsl:when>
<xsl:when test="string-length($str) &lt; $len">
<xsl:call-template name="pad-right">
<xsl:with-param name="str" select="concat($str, $pad)"/>
<xsl:with-param name="len" select="$len"/>
<xsl:with-param name="pad" select="$pad"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$str"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:param name="separator" select="';'"/>
<xsl:param name="line-separator" select="'&#13;&#10;'"/>


</xsl:stylesheet>
AnswerRe: How to create a semi-colon seperated file using XSL Pin
Stuart Dootson21-Aug-09 10:14
professionalStuart Dootson21-Aug-09 10:14 
QuestionGeneration of .cs pages using xml/xslt Pin
coolsharath17-Aug-09 20:59
coolsharath17-Aug-09 20:59 
QuestionData Definition Specification Pin
Nagaraj Muthuchamy16-Aug-09 22:53
professionalNagaraj Muthuchamy16-Aug-09 22:53 
QuestionPreventing and encrypting data from breaking Xml Structure Pin
Saksida Bojan12-Aug-09 4:11
Saksida Bojan12-Aug-09 4:11 
AnswerRe: Preventing and encrypting data from breaking Xml Structure Pin
Stuart Dootson12-Aug-09 21:41
professionalStuart Dootson12-Aug-09 21:41 
GeneralRe: Preventing and encrypting data from breaking Xml Structure Pin
Saksida Bojan12-Aug-09 23:09
Saksida Bojan12-Aug-09 23:09 
GeneralRe: Preventing and encrypting data from breaking Xml Structure Pin
Stuart Dootson12-Aug-09 23:19
professionalStuart Dootson12-Aug-09 23:19 
GeneralRe: Preventing and encrypting data from breaking Xml Structure Pin
Saksida Bojan12-Aug-09 23:24
Saksida Bojan12-Aug-09 23:24 
QuestionWindows Forms Layout using Xml Pin
Devaang1110-Aug-09 20:52
Devaang1110-Aug-09 20:52 
AnswerRe: Windows Forms Layout using Xml Pin
annathor10-Aug-09 21:11
annathor10-Aug-09 21:11 
GeneralRe: Windows Forms Layout using Xml Pin
Devaang1110-Aug-09 21:31
Devaang1110-Aug-09 21:31 
GeneralRe: Windows Forms Layout using Xml [modified] Pin
annathor10-Aug-09 21:48
annathor10-Aug-09 21:48 
GeneralRe: Windows Forms Layout using Xml Pin
Devaang1110-Aug-09 23:45
Devaang1110-Aug-09 23:45 
GeneralRe: Windows Forms Layout using Xml Pin
annathor11-Aug-09 0:26
annathor11-Aug-09 0:26 
QuestionAdd up elements value by matching name element Pin
RossBradley10-Aug-09 11:49
RossBradley10-Aug-09 11:49 
AnswerRe: Add up elements value by matching name element Pin
Stuart Dootson10-Aug-09 21:58
professionalStuart Dootson10-Aug-09 21:58 
Questioncan i format xml file, suggestion please ? Pin
lazy_dude5-Aug-09 20:35
lazy_dude5-Aug-09 20:35 

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.