Re: [xsl] How do you avoid relearning the same coding technique over and over?

Subject: Re: [xsl] How do you avoid relearning the same coding technique over and over?
From: "Liam R. E. Quin liam@xxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 6 Feb 2025 18:16:40 -0000
On Thu, 2025-02-06 at 12:19 +0000, Roger L Costello costello@xxxxxxxxx
wrote:
>
> What's the solution? Discipline? No matter how much I'm in a hurry,
> stop and create an example. Is that the solution?

Well,

locate .xsl | grep $HOME | xargs grel -l expath

will go a long way for me (Linux). Or,
find . -name "*.xsl*" -print0 | xargs -0 grep -l expath
if there might be spaces in filenames.

Often, though, i remember a particular occasion, a particular
transformation. If not, i go looking at the spec. If i canbt puzzle it
out from the spec i go looking for examples.

Asking an unreliable source such as chatgpt can be worse than a waste
of time, as it might plant ideas that lead to wrong underlying
assumptions that can be difficult to work past.

As Wendell out-pointed, you have to think about the bigger picture. An
example will just show you how to do one thing but not tell you the
best approach.

For example, if youbre using saxon, you can use collection() or uri-
collection() with try/catch to run XSLT over every file in a directory,
optionally recursively descending into subdirs (nested folders), and
not falling over if therebs malformed XML in there. In that case you
can use the doc() function.

Debbie Lapeyre and i once watched the late Michael Sperberg-McQueen
writing in a notepad. Asked what he was doing, he said he was working
on a list of things to think about.

Problem solving is a case of working out the right questions to think
about.

liam


--
Liam Quin,B https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations: B http://www.fromoldbooks.org

Current Thread