|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Ways to Identify & Process Same name XML elements
On Wed, Oct 25, 2017 at 12:34:55PM -0000, Alex S as.signup@xxxxxxxxxxx
scripsit:
> Some elements such as: <string> <array> <dict> appear repeatedly at
> multiple levels in this SB XML format, But they mean different things
> based on where they are located; mean different things at different
> locations, depths or parent/ ascendent
>
> What are the different ways I can tackle processing these elements
> and fix & improve my <xsl templates>?
There's a general XSLT 2.0-and-greater pattern, "chained processing",
where you can put a document node in a variable so you can pass the
result of one processing pass to the next using variables:
<xsl:variable name="pass1">
<xsl:apply-templates mode="preprocess"/>
</xsl:variable>
<xsl:apply-templates select="pass1"/>
This generalizes to arbitrarily many variables (presuming the documents
aren't large enough to give you memory issues at however many variables
you need) and I find it's a good way to keep different bits of the
processing logic distinct in the code and thus easier to debug.
So nothing wrong with doing what you're already doing and using a
pre-processing pass to give the elements distinct names depending on
position and then processing on that basis.
-- Graydon
|
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
|

Cart








