Tuesday, April 12, 2005

Pattern of the day

If you want to solve the problem , and the data does not suit your needs,

then change the data that will suit your need . E.g Tree traversals in XSLT , when we want traversals with the predecessor and sucessor elements printed, i can't acheive it with the tree structure as such because i am not really aware in which direction i need to go , because in one case
I need to go perhaps left and in the other case i need to travel up or whatever, so might be a
good idea to faltten the structure out and traverse and get predecessors and successors.

So that is really an awesome pattern to solve problems.

//* in XML gives a preorder traversal of the tree.

< xsl:copy > < xsl:copy-of > , the copy one operates on nodes.

Copy-of and value-of differences are , values -of does an implied conversion to text whereas
copy-of does not. Copy-of is a deep copy and Copy is a shallow copy.

Comment nodes are important , what if I want to count the nodes , comment , visit them explicitly

*(apply/templates) does not visit comment nodes so the built in template of comment might be
useful to use

copy actually grabs a node
value-of implies a conversion , copy-of no conversion nodes are outputted
template sits on one node

The entire motivation of XPATH is i am not worried abt memory i am going to load it all then process with powerful syntax

No order to the data that i have written today they are more of my class notes will give it a order one fine day :)


No comments: