|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Dynamically selecting Attributes
suresh talluri wrote:
> I recently came across this piece of code in this emailing list,can someone
> explain me wot excalty does this special characters do..
Sigh... I'll bite. You need to do some more reading.
Go to http://www.skew.org/xml/links/ and look at the section marked
'Specifications - XML and XSLT' and 'Tutorials - XML and XSLT'. In
particular you need to understand XSLT, and to understand XSLT you have to
understand XPath.
> <xsl:template match="find">
Assuming the 'xsl' prefix maps to the correct namespace URI, this encloses
an XSLT template that is a suitable match for an element node named
'find'. If the XSLT processor encounters such a node, there is a good
chance that the instructions in this template will be executed.
> <xsl:value-of select="//record/@*[name()=current()/@target]"/>
This is an XSLT instruction to create a text node in the result tree.
The character data in the text node will be the string-value of the first
node in the node-set identified by the XPath expression
//record/@*[name()=current()/@target]
/@* : attributes with any name, in any namespace, belonging to...
record : elements named record, that are...
// : descendants of the root node.
[ foo ] : narrows down the set to just those for which foo is true.
name() : name of the context node (attribute name, in this case).
= : equality comparison operator.
/@target : attributes named target, that are children of...
current() : the current node (the one that was current before this
instruction was instantiated, as opposed to the context node).
As per XPath rules, the comparison of a string (as returned by the name()
function) and a node-set (as identified by @target) will be handled
as a stringwise comparison, as if it were name()=string(current()/@target).
The concept of string-value and the interaction of the string() function
on node-sets is explained in the XPath Recommendation.
Hopefully someone will get something out of this.
- Mike
____________________________________________________________________
Mike J. Brown, software engineer at My XML/XSL resources:
webb.net in Denver, Colorado, USA http://www.skew.org/xml/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








