Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hello I have written the followi

Status
Not open for further replies.

mrnez

Technical User
Sep 11, 2002
37
GB
Hello

I have written the following transform (modified an existing one) ;) the problem I am having is the field that is made up of two instances of

<xsl:apply-templates select = &quot;head/docdata/key-list/keyword/@key&quot;/>

which forms a field user08, I need a space between the two items. I am sure this is simple enough, but I am very new to XML.

Any help would be greatly appreciated

Thanks

Rich


<?xml version = &quot;1.0&quot; encoding = &quot;UTF-8&quot;?>
<xsl:transform xmlns:xsl = &quot; version = &quot;1.0&quot;>
<xsl:template match = &quot;nitf&quot;>
<xsl:element name = &quot;hpsc&quot;>
<xsl:element name = &quot;hpsc-file&quot;>
<xsl:element name = &quot;user-def-data&quot;>
<xsl:element name = &quot;user-def-field&quot;>
<xsl:apply-templates select = &quot;head/docdata/urgency/@ed-urg&quot;/>
<xsl:apply-templates select = &quot;head/docdata/doc-scope/@scope&quot;/>
<xsl:apply-templates select = &quot;head/meta/@content&quot;/>
<xsl:apply-templates select = &quot;head/docdata/series/@series.part&quot;/>
<xsl:variable name = &quot;concatUser08&quot;>
<xsl:apply-templates select = &quot;head/docdata/key-list/keyword/@key&quot;/>
</xsl:variable>
<xsl:element name = &quot;user08&quot;>
<xsl:value-of select = &quot;$concatUser08&quot;/>
</xsl:element>
</xsl:element>
</xsl:element>
<xsl:element name = &quot;iptc-field&quot;>
<xsl:apply-templates select = &quot;body/body.head/distributor&quot;/>
</xsl:element>
</xsl:element>
<xsl:element name = &quot;nitf&quot;>
<xsl:element name = &quot;body&quot;>
<xsl:element name = &quot;body.head&quot;>
<xsl:element name = &quot;hedline&quot;>
<xsl:apply-templates select = &quot;body/body.head/hedline/hl1&quot;/>
</xsl:element>
</xsl:element>
<xsl:apply-templates select = &quot;body/body.content&quot;/>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template match = &quot;@content&quot;>
<xsl:if test = &quot;../@name='channel' &quot;>
<xsl:element name = &quot;user03&quot;>
<xsl:value-of select = &quot;.&quot;/>
</xsl:element>
</xsl:if>
</xsl:template>
<xsl:template match = &quot;@ed-urg&quot;>
<xsl:element name = &quot;user06&quot;>
<xsl:value-of select = &quot;.&quot;/>
</xsl:element>
</xsl:template>
<xsl:template match = &quot;@series.part&quot;>
<xsl:element name = &quot;user01&quot;>
<xsl:value-of select = &quot;.&quot;/>
</xsl:element>
</xsl:template>
<xsl:template match = &quot;@key&quot;>
<xsl:element name = &quot;user08&quot;>
<xsl:value-of select = &quot;.&quot;/>
</xsl:element>
</xsl:template>
<xsl:template match = &quot;@scope&quot;>
<xsl:element name = &quot;user07&quot;>
<xsl:value-of select = &quot;.&quot;/>
</xsl:element>
</xsl:template>
<xsl:template match = &quot;hl1&quot;>
<xsl:element name = &quot;hl1&quot;>
<xsl:value-of select = &quot;.&quot;/>
</xsl:element>
</xsl:template>
<xsl:template match = &quot;body.content&quot;>
<xsl:element name = &quot;body.content&quot;>
<xsl:value-of select = &quot;.&quot;/>
</xsl:element>
</xsl:template>
<xsl:template match = &quot;distributor&quot;>
<xsl:element name = &quot;iptc-source&quot;>
<xsl:value-of select = &quot;.&quot;/>
</xsl:element>
</xsl:template>
</xsl:transform>
 
just do this:

<xsl:element name = &quot;user08&quot;>
<xsl:value-of select = &quot;$concatUser08&quot;/> <xsl:value-of select = &quot;$concatUser08&quot;/>
</xsl:element>

... this should work, but sometimes it does depend on the parser. make sure you preserve whitespace with an <xsl:eek:utput> thingy.

matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top