Is there anyway to create a multi dimensional array like we do in procedural programming a[4,4,4] in XSLT, and if yes can anyone give a sample for that!
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Beyond simple sequences, the only way of implementing complex data structures in XSLT 2.0 is as XML trees. One way of implementing a three-dimensional array would be as a set of labelled cells:
Alternatively you could use a positional representation:
The problem with implementing algorithms such as CYK is that they are designed to use mutable data structures. This means that for efficiency, you often need something different in a functional language. For example, changing the content of one cell in the three-dimensional array may (depending on the implementation) involve making a copy of the whole structure. That doesn’t make functional programming intrinsically inefficient – it just means that you sometimes have to design different algorithms to take advantage of its strengths.
The constraint you’ve been given for this exercise – telling you what algorithm to use – is one that should never be included in a requirements statement. The requirements should describe the problem to be solved, and not constrain the way you choose to solve it.