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 7660045
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:24:46+00:00 2026-05-31T13:24:46+00:00

I have an XSLT file for transforming data from table to INSERT statements. So

  • 0

I have an XSLT file for transforming data from table to INSERT statements.
So the output looks like

INSERT INTO some_table VALUES (Voda, Šenov);

INSERT INTO some_table VALUES (Vorba, Vlčnov);

which is fine to me.
My XSLT contains this three lines

<xsl:for-each select="PAGE/ROWSET/ROW">
  INSERT INTO some_table VALUES (<xsl:value-of select="SURNAME"/>, <xsl:value-of select="CITY"/>);
</xsl:for-each>

And here is the question, I really dont want to put so many values on the same line(my table has like 20 columns) in order to maintain the formatting in output, so is there a way how to keep output the same and have my columns in INSERT on multiple lines in for-each?

Thanks a lot for answers

EDIT

I would like to have the for-each loop like this

<xsl:for-each select="PAGE/ROWSET/ROW">
  INSERT INTO some_table VALUES va1 ,val2 (
         <xsl:value-of select="SURNAME"/>, 
         <xsl:value-of select="CITY"/>);
</xsl:for-each>
  • 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-05-31T13:24:46+00:00Added an answer on May 31, 2026 at 1:24 pm

    Try

    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet
        version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
        <xsl:output method="text" version="1.0" encoding="UTF-8"/>
        <xsl:template match="/">
            <xsl:for-each select="PAGE/ROWSET/ROW">
                <xsl:text>INSERT INTO some_table VALUES val1 ,val2 (</xsl:text>
                     <xsl:value-of select="SURNAME"/><xsl:text>, </xsl:text>
                     <xsl:value-of select="CITY"/><xsl:text>);</xsl:text>
                     <xsl:text>&#xA;</xsl:text>
            </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>
    

    In XML Spy, with input

    <?xml version="1.0" encoding="UTF-8"?>
    <PAGE>
        <ROWSET>
            <ROW>
                <SURNAME>sn1</SURNAME>
                <CITY>c1</CITY>
            </ROW>
            <ROW>
                <SURNAME>sn2</SURNAME>
                <CITY>c2</CITY>
            </ROW>
        </ROWSET>
    </PAGE>
    

    I get

    INSERT INTO some_table VALUES val1 ,val2 (sn1, c1);
    INSERT INTO some_table VALUES val1 ,val2 (sn2, c2);
    
    • 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 that I am transforming via XSLT. I am passing
I have a project that I'm working that uses XSLT to display data from
I have made a small xslt file to create an html output called weather.xsl
I have an XSLT file so as to transform large amount of data. I
I have an xml file that looks like this: <args> <sometag value=abc /> <anothertag
I have an XSLT file generating plain HTML. I need to wrap some elements
How to access App_Data folder in WCF service? I have placed a xslt file
we have XSLT to transform XML into HTML in XHTML 1.0 Strict in XSLT
I have an XSLT transform issue: style=width:{Data/PercentSpaceUsed}%; And the value of Data/PercentSpaceUsed is integer
I have a .xslt that translates xml from one form to another (I'm not

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.