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

  • SEARCH
  • Home
  • 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 8254201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:06:44+00:00 2026-06-08T01:06:44+00:00

xslt have function(like substring vice versa) or how to solve it? I had xml:

  • 0

xslt have function(like substring vice versa) or how to solve it? I had xml:

<document>
<Line>
    <Line-Item>
        <LineNumber>10</LineNumber>
        <EAN>111</EAN>
        <BIC>123123</BIC>
        <SIC>AVD091</SIC>
    </Line-Item>
</Line>
<Line>
    <Line-Item>
        <LineNumber>20</LineNumber>
        <EAN>22222</EAN>
        <BIC>3232332</BIC>
        <SIC>AVD25482</SIC>
    </Line-Item>
</Line>
</document>

needed output:

10        111     123123      AVD091
20        22222   3232332     AVD25482

Field line number start from 1 column position, EAN start from 11 column position, BIC start from 19 and SIC from 31.

  • 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-08T01:06:45+00:00Added an answer on June 8, 2026 at 1:06 am

    Try this XSLT 1.0 style-sheet. The pad template is an XSLT 1.0 version of Martin’s mf:pad function.

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="text"/>
    
    <xsl:template match="/">
      <xsl:apply-templates select="document/Line/Line-Item"/>
    </xsl:template>
    
    <xsl:template name="pad">
      <xsl:param name="value" />
      <xsl:param name="width" />
      <xsl:variable name="col-max" select="'                    '"/>
      <xsl:value-of select="substring( concat($value,$col-max), 1, $width)" /> 
    </xsl:template>  
    
    <xsl:template match="Line-Item" >
    
     <xsl:call-template name="pad" >
      <xsl:with-param name="value" select="LineNumber"/>
      <xsl:with-param name="width" select="10" />
     </xsl:call-template>  
    
     <xsl:call-template name="pad" >
      <xsl:with-param name="value" select="EAN"/>
      <xsl:with-param name="width" select="8" />
     </xsl:call-template>  
    
     <xsl:call-template name="pad" >
      <xsl:with-param name="value" select="BIC"/>
      <xsl:with-param name="width" select="12" />
     </xsl:call-template>  
    
     <xsl:value-of select="SIC" /> 
    
     <xsl:value-of select="'&#x0A;'" />
    </xsl:template>  
    
    <xsl:template match="*" />
    </xsl:stylesheet>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a chained XSLT 2.0 transformation scenario (using saxon), like this: - I1.xml
we have XSLT to transform XML into HTML in XHTML 1.0 Strict in XSLT
I have a .xslt that translates xml from one form to another (I'm not
I have an XSLT stylesheet that transforms an XML file to JSON format and
OK so I have an xslt issue that I cannot seem to solve. This
I have an xslt stylesheet that needs to call a C# XSLT extension function
I have XML like this: <article> <title>Article 1 title</title> <text>Lorem ipsum...</text> <image>http://example.com/img_01.jpg</image> </article> <article>
In XSL is function like CONTAIN, that if i have number with simbol like
i have this XSLT and XML payload that i am wanting to transform. but
I have a question about formatting the output of the sum() function in XQuery/XSLT/XPath.

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.