How concat many attribute values for xml?How do I parse XML in Python?XML to CSV using XSLT helpHow do you parse and process HTML/XML in PHP?Chrome, Firefox and Safari not applying XSLT? IE does!How to pass “Null” (a real surname!) to a SOAP web service in ActionScript 3?Read SOAP XML by ASMX web servcie functionC#+Magento API V2:The content type text/xml; charset=utf-8,text/xml; charset=UTF-8 of the response message does not matchSOAP response/Request then how to convert it in to PHPXSLT change value node based on the value of another nodehow to solve [org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 1; Content is not allowed in prolog.]

Do you "gain" 1st level?

What unique challenges/limitations will I face if I start a career as a pilot at 45 years old?

Good textbook for queueing theory and performance modeling

Will using a resistor in series with a LED to control its voltage increase the total energy expenditure?

What should I do if actually I found a serious flaw in someone's PhD thesis and an article derived from that PhD thesis?

Is this n-speak?

Are employers legally allowed to pay employees in goods and services equal to or greater than the minimum wage?

Doesn't the speed of light limit imply the same electron can be annihilated twice?

How would you translate this? バタコチーズライス

Should I leave building the database for the end?

Is it possible to arrive in the US without a C-1 visa for a transit flight

What can Amex do if I cancel their card after using the sign up bonus miles?

How come the Rambam forbids picking up money found in the street?

Why did IBM make the PC BIOS source code public?

How to not forget things?

graphs in latex

Dogfights in outer space

Causal Diagrams using Wolfram?

Do beef farmed pastures net remove carbon emissions?

Transition to "Starvation Mode" in Survival Situations

In which case does the Security misconfiguration vulnerability apply to?

Installing Windows to flash UEFI/ BIOS, then reinstalling Ubuntu

Why won't the Republicans use a superdelegate system like the DNC in their nomination process?

Is there a way to proportionalize fixed costs in a MILP?



How concat many attribute values for xml?


How do I parse XML in Python?XML to CSV using XSLT helpHow do you parse and process HTML/XML in PHP?Chrome, Firefox and Safari not applying XSLT? IE does!How to pass “Null” (a real surname!) to a SOAP web service in ActionScript 3?Read SOAP XML by ASMX web servcie functionC#+Magento API V2:The content type text/xml; charset=utf-8,text/xml; charset=UTF-8 of the response message does not matchSOAP response/Request then how to convert it in to PHPXSLT change value node based on the value of another nodehow to solve [org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 1; Content is not allowed in prolog.]






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















SOAP Message:



<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<field_21>
<row StartDate="2017-01-01" EndDate="2017-01-07" DaysCount="7" Diagnoz="A00.0"/>
<row StartDate="2019-02-01" EndDate="2019-02-07" DaysCount="8" Diagnoz="A10.0"/>
</field_21>
</soapenv:Body>
</soapenv:Envelope>


My xslt:



<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" version="1.0">
<xsl:template match="/">
<result>
<xsl:value-of select="string-join(
concat(//field_21/row/@StartDate, ' ',
//field_21/row/@EndDate, ' ',
//field_21/row/@DaysCount, ' ',
//field_21/row/@Diagnoz), ';')"/>
</result>
</xsl:template>
</xsl:stylesheet>


Result:



<result xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">2017-01-01 2017-01-07 7 A00.0</result>


The result that I need:



<result xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">2017-01-01 2017-01-07 7 A00.0; 2019-02-01 2019-02-07 8 A10.0</result>


Tell me how to correct my conversion to get the required result










share|improve this question
























  • can you use 2.0 or 1.0 only?

    – Amrendra Kumar
    Mar 27 at 11:09

















1















SOAP Message:



<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<field_21>
<row StartDate="2017-01-01" EndDate="2017-01-07" DaysCount="7" Diagnoz="A00.0"/>
<row StartDate="2019-02-01" EndDate="2019-02-07" DaysCount="8" Diagnoz="A10.0"/>
</field_21>
</soapenv:Body>
</soapenv:Envelope>


My xslt:



<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" version="1.0">
<xsl:template match="/">
<result>
<xsl:value-of select="string-join(
concat(//field_21/row/@StartDate, ' ',
//field_21/row/@EndDate, ' ',
//field_21/row/@DaysCount, ' ',
//field_21/row/@Diagnoz), ';')"/>
</result>
</xsl:template>
</xsl:stylesheet>


Result:



<result xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">2017-01-01 2017-01-07 7 A00.0</result>


The result that I need:



<result xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">2017-01-01 2017-01-07 7 A00.0; 2019-02-01 2019-02-07 8 A10.0</result>


Tell me how to correct my conversion to get the required result










share|improve this question
























  • can you use 2.0 or 1.0 only?

    – Amrendra Kumar
    Mar 27 at 11:09













1












1








1


1






SOAP Message:



<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<field_21>
<row StartDate="2017-01-01" EndDate="2017-01-07" DaysCount="7" Diagnoz="A00.0"/>
<row StartDate="2019-02-01" EndDate="2019-02-07" DaysCount="8" Diagnoz="A10.0"/>
</field_21>
</soapenv:Body>
</soapenv:Envelope>


My xslt:



<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" version="1.0">
<xsl:template match="/">
<result>
<xsl:value-of select="string-join(
concat(//field_21/row/@StartDate, ' ',
//field_21/row/@EndDate, ' ',
//field_21/row/@DaysCount, ' ',
//field_21/row/@Diagnoz), ';')"/>
</result>
</xsl:template>
</xsl:stylesheet>


Result:



<result xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">2017-01-01 2017-01-07 7 A00.0</result>


The result that I need:



<result xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">2017-01-01 2017-01-07 7 A00.0; 2019-02-01 2019-02-07 8 A10.0</result>


Tell me how to correct my conversion to get the required result










share|improve this question














SOAP Message:



<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<field_21>
<row StartDate="2017-01-01" EndDate="2017-01-07" DaysCount="7" Diagnoz="A00.0"/>
<row StartDate="2019-02-01" EndDate="2019-02-07" DaysCount="8" Diagnoz="A10.0"/>
</field_21>
</soapenv:Body>
</soapenv:Envelope>


My xslt:



<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" version="1.0">
<xsl:template match="/">
<result>
<xsl:value-of select="string-join(
concat(//field_21/row/@StartDate, ' ',
//field_21/row/@EndDate, ' ',
//field_21/row/@DaysCount, ' ',
//field_21/row/@Diagnoz), ';')"/>
</result>
</xsl:template>
</xsl:stylesheet>


Result:



<result xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">2017-01-01 2017-01-07 7 A00.0</result>


The result that I need:



<result xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">2017-01-01 2017-01-07 7 A00.0; 2019-02-01 2019-02-07 8 A10.0</result>


Tell me how to correct my conversion to get the required result







xml xslt soap wso2






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 27 at 10:58









serjio_designserjio_design

84 bronze badges




84 bronze badges















  • can you use 2.0 or 1.0 only?

    – Amrendra Kumar
    Mar 27 at 11:09

















  • can you use 2.0 or 1.0 only?

    – Amrendra Kumar
    Mar 27 at 11:09
















can you use 2.0 or 1.0 only?

– Amrendra Kumar
Mar 27 at 11:09





can you use 2.0 or 1.0 only?

– Amrendra Kumar
Mar 27 at 11:09












1 Answer
1






active

oldest

votes


















2














This is slightly confusing because your stylesheet has version="1.0" in it, but string-join is only available in XSLT 2.0. However, if you were using XSLT 2.0, I would expect the concat to failure because //field_21/row/@StartDate returns multiple nodes, which would not be allowed in XSLT 2.0



But, if you are indeed using XSLT 2.0, you could write the expression like this:



<xsl:value-of select="string-join(//field_21/row/concat(@StartDate, ' ', @EndDate, ' ', @DaysCount, ' ', @Diagnoz), ';')"/>


Or, like this, to take advantage of the separator attribute available in XSLT 2.0.



<xsl:value-of select="//field_21/row/concat(@StartDate, ' ', @EndDate, ' ', @DaysCount, ' ', @Diagnoz)" separator="; " />


If, however, you can only use XSLT 1.0, you would have to use xsl:for-each (or xsl:apply-templates



<xsl:for-each select="//field_21/row">
<xsl:if test="position() > 1">; </xsl:if>
<xsl:value-of select="concat(@StartDate, ' ', @EndDate, ' ', @DaysCount, ' ', @Diagnoz)" />
</xsl:for-each>





share|improve this answer

























  • For 2.0 you can use like <xsl:value-of select="string-join(for $val in /*:Envelope/*:Body/field_21/row return concat($val/@StartDate, ' ', $val/@EndDate, ' ',$val/@DaysCount, ' ',$val/@Diagnoz),', ')"/>

    – Amrendra Kumar
    Mar 27 at 11:17










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55375545%2fhow-concat-many-attribute-values-for-xml%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














This is slightly confusing because your stylesheet has version="1.0" in it, but string-join is only available in XSLT 2.0. However, if you were using XSLT 2.0, I would expect the concat to failure because //field_21/row/@StartDate returns multiple nodes, which would not be allowed in XSLT 2.0



But, if you are indeed using XSLT 2.0, you could write the expression like this:



<xsl:value-of select="string-join(//field_21/row/concat(@StartDate, ' ', @EndDate, ' ', @DaysCount, ' ', @Diagnoz), ';')"/>


Or, like this, to take advantage of the separator attribute available in XSLT 2.0.



<xsl:value-of select="//field_21/row/concat(@StartDate, ' ', @EndDate, ' ', @DaysCount, ' ', @Diagnoz)" separator="; " />


If, however, you can only use XSLT 1.0, you would have to use xsl:for-each (or xsl:apply-templates



<xsl:for-each select="//field_21/row">
<xsl:if test="position() > 1">; </xsl:if>
<xsl:value-of select="concat(@StartDate, ' ', @EndDate, ' ', @DaysCount, ' ', @Diagnoz)" />
</xsl:for-each>





share|improve this answer

























  • For 2.0 you can use like <xsl:value-of select="string-join(for $val in /*:Envelope/*:Body/field_21/row return concat($val/@StartDate, ' ', $val/@EndDate, ' ',$val/@DaysCount, ' ',$val/@Diagnoz),', ')"/>

    – Amrendra Kumar
    Mar 27 at 11:17















2














This is slightly confusing because your stylesheet has version="1.0" in it, but string-join is only available in XSLT 2.0. However, if you were using XSLT 2.0, I would expect the concat to failure because //field_21/row/@StartDate returns multiple nodes, which would not be allowed in XSLT 2.0



But, if you are indeed using XSLT 2.0, you could write the expression like this:



<xsl:value-of select="string-join(//field_21/row/concat(@StartDate, ' ', @EndDate, ' ', @DaysCount, ' ', @Diagnoz), ';')"/>


Or, like this, to take advantage of the separator attribute available in XSLT 2.0.



<xsl:value-of select="//field_21/row/concat(@StartDate, ' ', @EndDate, ' ', @DaysCount, ' ', @Diagnoz)" separator="; " />


If, however, you can only use XSLT 1.0, you would have to use xsl:for-each (or xsl:apply-templates



<xsl:for-each select="//field_21/row">
<xsl:if test="position() > 1">; </xsl:if>
<xsl:value-of select="concat(@StartDate, ' ', @EndDate, ' ', @DaysCount, ' ', @Diagnoz)" />
</xsl:for-each>





share|improve this answer

























  • For 2.0 you can use like <xsl:value-of select="string-join(for $val in /*:Envelope/*:Body/field_21/row return concat($val/@StartDate, ' ', $val/@EndDate, ' ',$val/@DaysCount, ' ',$val/@Diagnoz),', ')"/>

    – Amrendra Kumar
    Mar 27 at 11:17













2












2








2







This is slightly confusing because your stylesheet has version="1.0" in it, but string-join is only available in XSLT 2.0. However, if you were using XSLT 2.0, I would expect the concat to failure because //field_21/row/@StartDate returns multiple nodes, which would not be allowed in XSLT 2.0



But, if you are indeed using XSLT 2.0, you could write the expression like this:



<xsl:value-of select="string-join(//field_21/row/concat(@StartDate, ' ', @EndDate, ' ', @DaysCount, ' ', @Diagnoz), ';')"/>


Or, like this, to take advantage of the separator attribute available in XSLT 2.0.



<xsl:value-of select="//field_21/row/concat(@StartDate, ' ', @EndDate, ' ', @DaysCount, ' ', @Diagnoz)" separator="; " />


If, however, you can only use XSLT 1.0, you would have to use xsl:for-each (or xsl:apply-templates



<xsl:for-each select="//field_21/row">
<xsl:if test="position() > 1">; </xsl:if>
<xsl:value-of select="concat(@StartDate, ' ', @EndDate, ' ', @DaysCount, ' ', @Diagnoz)" />
</xsl:for-each>





share|improve this answer













This is slightly confusing because your stylesheet has version="1.0" in it, but string-join is only available in XSLT 2.0. However, if you were using XSLT 2.0, I would expect the concat to failure because //field_21/row/@StartDate returns multiple nodes, which would not be allowed in XSLT 2.0



But, if you are indeed using XSLT 2.0, you could write the expression like this:



<xsl:value-of select="string-join(//field_21/row/concat(@StartDate, ' ', @EndDate, ' ', @DaysCount, ' ', @Diagnoz), ';')"/>


Or, like this, to take advantage of the separator attribute available in XSLT 2.0.



<xsl:value-of select="//field_21/row/concat(@StartDate, ' ', @EndDate, ' ', @DaysCount, ' ', @Diagnoz)" separator="; " />


If, however, you can only use XSLT 1.0, you would have to use xsl:for-each (or xsl:apply-templates



<xsl:for-each select="//field_21/row">
<xsl:if test="position() > 1">; </xsl:if>
<xsl:value-of select="concat(@StartDate, ' ', @EndDate, ' ', @DaysCount, ' ', @Diagnoz)" />
</xsl:for-each>






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 27 at 11:13









Tim CTim C

64.2k13 gold badges62 silver badges85 bronze badges




64.2k13 gold badges62 silver badges85 bronze badges















  • For 2.0 you can use like <xsl:value-of select="string-join(for $val in /*:Envelope/*:Body/field_21/row return concat($val/@StartDate, ' ', $val/@EndDate, ' ',$val/@DaysCount, ' ',$val/@Diagnoz),', ')"/>

    – Amrendra Kumar
    Mar 27 at 11:17

















  • For 2.0 you can use like <xsl:value-of select="string-join(for $val in /*:Envelope/*:Body/field_21/row return concat($val/@StartDate, ' ', $val/@EndDate, ' ',$val/@DaysCount, ' ',$val/@Diagnoz),', ')"/>

    – Amrendra Kumar
    Mar 27 at 11:17
















For 2.0 you can use like <xsl:value-of select="string-join(for $val in /*:Envelope/*:Body/field_21/row return concat($val/@StartDate, ' ', $val/@EndDate, ' ',$val/@DaysCount, ' ',$val/@Diagnoz),', ')"/>

– Amrendra Kumar
Mar 27 at 11:17





For 2.0 you can use like <xsl:value-of select="string-join(for $val in /*:Envelope/*:Body/field_21/row return concat($val/@StartDate, ' ', $val/@EndDate, ' ',$val/@DaysCount, ' ',$val/@Diagnoz),', ')"/>

– Amrendra Kumar
Mar 27 at 11:17






Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55375545%2fhow-concat-many-attribute-values-for-xml%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript