xsl-list
[Top] [All Lists]

[xsl] Select one from Multiple Values and Order Values

2006-10-16 15:53:17
Hello,

I need to select the URL value from multiple values in dc:identifier in a xml record as a base identifier (rdf:Description rdf:about). And I need to represent all dc:identifier values in a rdf file with the order of http URL value first.

For example, here is my xml document.

<dc:identifier>AJ-097</dc:identifier>
<dc:identifier>TMK2534</dc:identifier>
<dc:identifier>http://content.wisconsinhistory.org/u?/aj,71</dc:identifier>

And here is my expected rdf document.
<rdf:Description rdf:about="http://content.wisconsinhistory.org/u?/aj,71";>
                <rdf:type rdf:resource="http://purl.org/gem/qualifiers/GEM2"/>
                
<dc:identifier>http://content.wisconsinhistory.org/u?/aj,71</dc:identifier>
                                <dc:identifier>AJ-097</dc:identifier>
                                <dc:identifier>TMK2534</dc:identifier>

I tried to handle this. But, kind of stuck now.

Could you give some advice?

Here is my xslt.

<xsl:template match="oai_dc:dc">
     <xsl:variable name="identifier">
<xsl:if test="http"> <xsl:value-of select="normalize-space(dc:identifier)"/> </xsl:if>
     </xsl:variable>
<rdf:Description>
<xsl:attribute name="rdf:about"><xsl:value-of select="$identifier"/></xsl:attribute>
     <rdf:type rdf:resource="http://purl.org/gem/qualifiers/GEM2"/>
                <xsl:apply-templates select="dc:identifier"/>
 </rdf:Description>
</rdf:RDF>
</xsl:template>

<xsl:template match="dc:identifier">
    <xsl:choose>
     <xsl:when test=". = 'http'">
<dc:identifier><xsl:value-of select="normalize-space(.)"/></dc:identifier>
     </xsl:when>
     <xsl:otherwise>
<dc:identifier><xsl:value-of select="normalize-space(.)"/></dc:identifier></xsl:otherwise>
     </xsl:choose>
</xsl:template>

Thanks a lot in Advance,

Best regards,
Ryan

_________________________________________________________________
All-in-one security and maintenance for your PC. Get a free 90-day trial! http://clk.atdmt.com/MSN/go/msnnkwlo0050000002msn/direct/01/?href=http://www.windowsonecare.com/?sc_cid=msn_hotmail


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>
  • [xsl] Select one from Multiple Values and Order Values, oknam park <=