xml - How do I concatenate 4 elements? -


i show address in 1 line. how do this? my code showing this:

<nc:streetfulltext>607 main st w</nc:streetfulltext> 

i know need add 'city', 'state', 'zip' end of line of code associatedvalue[@type='street1']/text not sure how it.

desired output

<nc:streetfulltext>607 main st w, new york, dc 77777</nc:streetfulltext> 

my xml

      <enumerationvalue code="dc042015j">     <associatedvalue type="street1">       <text>607 main st w</text>     </associatedvalue>     <associatedvalue type="city">       <text>new york</text>     </associatedvalue>     <associatedvalue type="state">       <text>mn</text>     </associatedvalue>     <associatedvalue type="zip">       <text>77777</text>     </associatedvalue>   </enumerationvalue>   <enumerationvalue code="dc046015j"> 

xslt code

<nc:streetfulltext>     <xsl:variable name="vcourtori">         <xsl:value-of select="/integration/case/court/courtncic"/>     </xsl:variable>     <xsl:value-of select="document(concat($genvpath,'\schemas\courtxml\simpletypes\courtlocationtexttype.xml'))/simpletypecompanion/enumerationvalue[@code=$vcourtori]/associatedvalue[@type='street1']/text"/> </nc:streetfulltext> 

consider using variable select associatedvalue elements in document

<xsl:variable name="values"                select="document(concat($genvpath,'\schemas\courtxml\simpletypes\courtlocationtexttype.xml'))/simpletypecompanion/enumerationvalue[@code=$vcourtori]/associatedvalue" /> 

then can street, , rest of address doing this:

 <xsl:value-of select="concat($values[@type='street1']/text, ', ', $values[@type='city']/text, ', ', $values[@type='state']/text, ' ', $values[@type='zip']/text)"/> 

alternatively, write out separate statements display address, rather try , in 1 line

<xsl:value-of select="$values[@type='street1']/text"/> <xsl:text>, </xsl:text> <xsl:value-of select="$values[@type='city']/text"/> <xsl:text>, </xsl:text> <xsl:value-of select="$values[@type='state']/text"/> <xsl:text> </xsl:text> <xsl:value-of select="$values[@type='zip']/text"/> 

Comments