Re: XSL help
I am new to XSL:key.From XSLT 2.0: http://www.w3.org/TR/xslt20/#function-key
The result is a sequence containing every node $N that satisfies the following conditions:
|$N/ancestor-or-self::node() intersect $top| is non-empty. (If the third argument is omitted, |$top| defaults to |/|)
$N matches the pattern specified in the |match| attribute of an |xsl:key| <http://www.w3.org/TR/xslt20/#element-key> declaration whose |name| attribute matches the name specified in the |$key-name| argument.
When the key specifier <http://www.w3.org/TR/xslt20/#dt-key-specifier> of that |xsl:key| <http://www.w3.org/TR/xslt20/#element-key> declaration is evaluated with a singleton focus <http://www.w3.org/TR/xslt20/#dt-singleton-focus> based on $N, the atomized <http://www.w3.org/TR/xslt20/#dt-atomization> value of the resulting sequence includes a value that compares equal to at least one item in the atomized value of the sequence supplied as |$key-value|, under the rules of the |eq| operator with the collation selected as described above.
Somewhere you need an index declaration by using xsl:key tag, for example,
<xsl:key name="func" match="prototype" use="@name"/>
The $index in your question refer to the name of the index, in my example, the "func". The $key is matched against all nodes that matches "prototype" and the value of the "@name" attribute is compared to the $key variable. All nodes whose @name attribute matches the $key in an element that matched the pattern "prototype" are part of the sequence
<a> <prototype @name="1"> One </protoype>
<prototype @name="2"> Two </protoype>
<prototype @name="1"> Three </protoype> </a>
and the statement <xsl:variable name="zz" select="key('func','1')"/> would set the variable zz to the two elements prototype with text "One" and "Three".
The behavior in XSLT 1.0 is similar. See http://www.w3.org/TR/xslt#function-key.
2) To find long descripting, the existing xsl mapping for Type="PP" and searching keyword for ZZ. Question: without specifying the attibue name such as Pkey and Type....How it searching the output of LongDes as ZO Contracts ???
I do not understand the question. Do you want to search all elements with an attribute "LongDes" that matches the value "ZO Contracts"?
From the exising Input xml file,
-- Carpe Diem! === Jonas Mellin, Assistant Professor in Computer Science School of Humanities and Informatics, Building E-2 University of Skvvde, P.O. Box 408, SE-541 28 Skvvde, Sweden Phone: +46 500 448321, Fax: +46 500 448399 Email: jonas.mellin@xxxxxx, URL: http://www.his.se/melj
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