[
Lists Home |
Date Index |
Thread Index
]
>
> [Rasmussen, John]
>
> > I need to paginate, (reduce in size), certain nodes of an xml doc, say
> > x/y/z. This would evolve reading and writing nodes, and truncating the
> node
> > in question.
> >
> > I had originally written an xslt to use an xpath expression, which works
> > fine. Problem is I need to do this for many doc, and the xpath
> expression
> > changes. Passing the expression failed as select=$varName will
> only work
> > for one node. See XSLT Programmer's Reference, 2nd Edition page 426.
> >
>
> This would be a good place to write a stylesheet that creates a second
> stylesheet that does the actual work you want to do. Pass it the
> right path
> expression as a parameter, run the first stylesheet to create the second,
> then run the second on your xml file.
>
> Cheers,
>
> Tom P
>
Our Stage II application has a feature we call 'XPath+.' The basic
application allows you to choose from a list of built-in 'actions' that are
applied to XML pipelines. These built-in actions include things like XPath
filtering, content merging, and transforming. No coding necessary, just pick
from the list.
All action parameters are resolved for AVTs, so you can do things like:
- Set variable A to value of XPath expression /foo/bar (from the XML in the
pipeline).
- Filter the contents of the pipeline with Xpath param <= /foo/{$A}
- Add a node to the current XML tree. Node name is "node-{$A}" with an
attribute called "key-{$A}" and value "val-{$A}"
- Remove all nodes that match //{$A}.
- Replace all occurrences of {$A} with foo-{$A} (or 'b').
Basically at runtime you can define XPath expressions whose terms are
generated dynamically based on the value of the incoming tree (or passed-in
parameters).
Other things you can do with "A" inside the pipeline using the built-in
actions:
- Write the XML in the pipeline to file-{$A}.xml.
- Blow away the data in the pipeline with data loaded from input-{$A}.xml.
- Add XML data from http://www.{$A}.com to the contents loaded from
{$A}.xml.
- Invoke an XSLT stylesheet called foo-{$A}.xsl on the pipeline .
- Directly call a Java, Perl, COM, or SOAP method and pass "A" as a
parameter.
- POST the XML in the pipeline pipeline (or fragments) to
http://www.{$A}.com.
- Write the pipeline contents to an ODBC dataset called {$A}-db.
- Invoke an XSLT transform and pass {$A} as a parameter down to it.
- Save the pipeline file (which can contain both data and 'actions') and
invoke it via HTTP/REST or SOAP. Let the caller specify "A" as a parameter.
- POST an HTML FORM to the pipeline file. If the form has a field called "A"
its value is automatically available inside the pipeline file (via {$A}).
- Invoke the pipeline file from Java (or several other programming
languages) and pass "A" as a parameter.
It might be a bit easier than writing an XSLT generator. Stage II is part of
the NetGlue platform which is free for developer and personal use.
Best,
Ramin
http://www.wizen.com
|