2017-12-26 37 views
1

XMLを固定幅ファイルに変換しようとしましたが、パラメータxtt:fixedLengthがXSLT変換で動作しません。ここに私のXSLTがあるxttの問題:WorkdayソフトウェアのfixedLength

<?xml version="1.0" encoding="UTF-8"?> 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" 
    version="2.0" xmlns:wd="urn:com.workday.report/INT069_REP-Emp_File" 
    xmlns:lancet="http://example.com/mf" 
    xmlns:xtt="urn:com.workday/xtt" xmlns:etv="urn:com.workday/etv"> 

    <xsl:variable name="lineFeeder" select="'&#13;&#10;'" /> 
    <xsl:template match="/wd:Report_Data"> 
     <root> 
      <xsl:for-each select="wd:Report_Entry"> 
       <Company_code xtt:fixedLength="4" xtt:paddingCharacter="0" xtt:align="right"> 
        <xsl:value-of select="format-number(wd:Company, '0000')" /> 
       </Company_code> 
       <Employee_ID xtt:fixedLength="9" xtt:paddingCharacter="0" xtt:align="right"> 
        <xsl:value-of select="format-number(wd:Employee_ID, '000000000')" /> 
       </Employee_ID> 
       <Last_Name xtt:fixedLength="30"> 
        <xsl:value-of select="lancet:stripSpecialChars(replace(normalize-unicode(translate(wd:Last_Name, ',', ''), 'NFKD'), '⁄', '/'))" /> 
       </Last_Name> 
       <First_name xtt:fixedLength="15"> 
        <xsl:value-of select="lancet:stripSpecialChars(replace(normalize-unicode(translate(wd:First_Name, ',', ''), 'NFKD'), '⁄', '/'))" /> 
       </First_name> 
       <Status xtt:fixedLength="2"> 
        <xsl:value-of select="wd:status" /> 
       </Status> 
       <Cost_Center xtt:fixedLength="5"> 
        <xsl:value-of select="wd:Cost_Center" /> 
       </Cost_Center> 
       <xsl:text>&#x0A;</xsl:text> 
      </xsl:for-each> 
     </root> 
    </xsl:template> 

    <xsl:function name="lancet:stripSpecialChars"> 
     <xsl:param name="string" /> 
     <xsl:variable name="AllowedSymbols" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz()*%$#@!~&lt;&gt;,.?[]=- + /\ '" /> 
     <xsl:value-of select="translate($string, translate($string, $AllowedSymbols, ''), ' ')" /> 
    </xsl:function> 
</xsl:stylesheet> 

私は取得しています出力は、私はこの

0001013507738HALL(ここでは26個の余分なスペース)ERICA(10の余分なスペースのようなものを必要とし

0001013507738HALLERICA01050

ですここに)010 50

私のxtt:FixedLengthは機能しません。これで私を助けてください。

おかげ

答えて

1

XTTを削除してください:平日のドキュメントごとなど

<Company_code xtt:fixedLength="4" xtt:paddingCharacter="0"> 
    <xsl:value-of select="format-number(wd:Company, '0000')" /> 
</Company_code> 

以下のように、各タグから= "右" を揃える、

<Sample xtt:align="right"> 
    <item xtt:fixedLength="10">Short</item> 
    <item xtt:fixedLength="10">Much Too Long</item> 
    <item xtt:fixedLength="10">Just Right</item> 
</Sample> 
を揃えます

Outp UT

ShortMuchすぎるとして、ljust右


固定長

<Sample> 
    <item xtt:fixedLength="10">Short</item> 
    <item xtt:fixedLength="10">Much Too Long</item> 
    <item xtt:fixedLength="10">Just Right</item> 
</Sample> 

出力

ショート[5 chars]はあまりにとして、ljust右


paddingCharacter

<Sample xtt:paddingCharacter="-"> 
    <item xtt:fixedLength="10">Short</item> 
    <item xtt:fixedLength="10">Much Too Long</item> 
    <item xtt:fixedLength="10">Just Right</item> 
</Sample> 

出力

ショート-----すぎるとして、ljust右

Reference

関連する問題