[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Changing a specific attribute value

Subject: RE: Changing a specific attribute value
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 28 Feb 2005 21:49:13 -0000
xmlns q1 missing
match="vr:Resource/@xsi:type[@xsi:type='q1:ConeSearch']

You mean

match="vr:Resource/@xsi:type[.='q1:ConeSearch']

An xsi:type attribute never has an xsi:type attribute.

Michael Kay
http://www.saxonica.com/
 

> -----Original Message-----
> From: andrew cooke [mailto:acooke@xxxxxxxx] 
> Sent: 28 February 2005 21:23
> To: xsl 
> Subject:  Changing a specific attribute value
> 
> 
> Hi,
> 
> Sorry to bother you.  I'm going round in circles here and would
> appreciate help with the following.
> 
> I would like to transform data like:
> 
> ...
>   <metadata>
>     <vr:Resource xmlns:vr="http://www.ivoa.net/xml/VOResource/v0.10"
> xmlns:oai="http://www.openarchives.org/OAI/2.0/"
> xmlns:oxf="http://www.orbeon.com/oxf/processors"
> xmlns:carn="http://www.cacr.caltech.edu/projects/us-vo/schemas
> /Carnivore"
> xmlns:p="http://www.orbeon.com/oxf/pipeline" xsi:type="q1:ConeSearch"
> updated="2005-02-11">
>       <title xmlns="http://www.ivoa.net/xml/VOResource/v0.10"
> xmlns:q1="http://www.ivoa.net/xml/ConeSearch/v0.3">Sloan Digitized Sky
> Survey(DR3)</title>
>       <shortName xmlns="http://www.ivoa.net/xml/VOResource/v0.10"
> ...
> 
> so that the "xsitype" attribute of vr:Resource has the value
> "cs:ConeSearch" (yes, there's something suspicious in that q1 is
> defined as a namespace abbreviation in the next element - 
> that's not my
> problem, I am treating the attribute value as a simple string)
> 
> I am trying to use the following template:
> 
>   <xsl:stylesheet version="2.0">
>     <xsl:template match="vr:Resource">
>       <vr:Resource>
>         <xsl:apply-templates select="@*"/>
>         <xsl:apply-templates select="*"/>
>       </vr:Resource>
>     </xsl:template>
>     <xsl:template 
> match="vr:Resource/@xsi:type[@xsi:type='q1:ConeSearch']"
>                   priority="2">
>       <xsl:attribute name="xsi:type">cs:ConeSearch</xsl:attribute>
>     </xsl:template>
>     <xsl:template match="vr:Resource/@*">
>       <xsl:copy-of select="."/>
>     </xsl:template>
>     <xsl:template match="*">
>       <xsl:copy>
>         <xsl:apply-templates/>
>       </xsl:copy>
>     </xsl:template>
>   </xsl:stylesheet>
> 
> This is inside a pipeline system, and the namespace 
> defintions are in the
> environment.  However, this is not working (the element and 
> attributes are
> copied - if I supply a different element name it is used - but the
> attribute value for xsi:type is unaltered).  My questions are:
> 
> - Why isn't this changing the attribute value?
> 
> - Why do I need to explicitly apply the templates to each attribute?
>   Shouldn't that be done by the built-in rules? (If I don't, 
> it seems to
> only process attributes "up to" the xsi:type).
> 
> I'm basing my solution on
> http://www.stylusstudio.com/xsllist/200402/post30540.html if that
> helps explain anything.
> 
> Help would be very much appreciated.  There's something I'm 
> missing when
> it comes to attributes, and I don't understand what it is.
> 
> Thanks,
> Andrew
> 
> -- 
> ` __ _ __ ___  ___| |_____   work web site: 
> http://www.ctio.noao.edu/~andrew
>  / _` / _/ _ \/ _ \ / / -_)  personal web site: 
> http://www.acooke.org/andrew
>  \__,_\__\___/\___/_\_\___|  list: 
> http://www.acooke.org/andrew/compute.html

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.