cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ed Staub <est...@silknet.com>
Subject RE: Dynamic XPath filtering
Date Sat, 03 Jun 2000 01:49:01 GMT
I don't believe this should work; according to the spec, <xsl:attribute> is
supposed to emit attributes into the result tree, which the <xsl:variable>
is not part of.
-Ed

-----Original Message-----
From: gross@Cyveillance.com [mailto:gross@Cyveillance.com]
Sent: Friday, June 02, 2000 3:50 PM
To: cocoon-users@xml.apache.org
Subject: RE: Dynamic XPath filtering


Yes, this could work, but is far too slow.  It looks like it has to go
through every attribute of every node to find the right one.  What would be
ideal is something like this:

<xsl:variable name="filteredData">
 	<xsl:attribute name="select">$data//row[@<xsl:value-of
select="$attr"/>!='']</xsl:attribute>
</xsl:variable>

	- Greg

> -----Original Message-----
> From: Ed Staub [mailto:estaub@silknet.com]
> Sent: Friday, June 02, 2000 3:09 PM
> To: 'cocoon-users@xml.apache.org'
> Subject: RE: Dynamic XPath filtering
> 
> 
> (Hint/Plug:) The answer was in the first place I always look 
> for gnarly XSLT
> info: the intro to XSLT from Crane Softwrights 
> (www.cranesoftwrights.com).
> Searching for "$@" found a page which is directly on point.
> 
> You want to use something like 
> <xsl:variable name="filteredData"
> select="$data//row[@*[local-name(.)=$attr]]"/>
> 
> Please note: I haven't tried this!
> 
> -Ed Staub
> Kana Communications, Inc.
> 
> -----Original Message-----
> From: gross@Cyveillance.com [mailto:gross@Cyveillance.com]
> Sent: Friday, June 02, 2000 2:08 PM
> To: cocoon-users@xml.apache.org
> Subject: Dynamic XPath filtering
> 
> 
> I am trying to use XPath to filter a node-set.  This works 
> great when I know
> which attribute I'm filtering on ahead of time.  For example:
> 
> <xsl:variable name="data" select="document('page.xml')"/>
> <xsl:variable name="filteredData" select="$data//row[@name!='']"/>
> 
> However, when I don't know the name of the attribute ahead of 
> time, it gets
> upset.  For example:
> 
> <xsl:variable name="attr" select="name"></xsl:variable>
> <xsl:variable name="filteredData" select="$data//row[@$attr!='']"/>
> 
> Does anyone know how to do this?
> 
> 	- Greg
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org

Mime
View raw message