[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Connecting the Source and Destination fields
Note: I hope someone with more experience than I have is following this thread to oppose if I'm wrong. As far (or near) as I understand micro-pipelining, I'd try to achieve these steps: 1. Create a variable which contains the input-XML with the mentioned changes (insert a block-attribute). This should be possible doing something like below (not tested!!!!, and you have to transform it to proper XSLT 2.0) <xsl:variable name="firststep"> <xsl:apply-templates select="/" mode="firststep"> </xsl:variable> <xsl:template match="node()|@*" mode="firststep"> <xsl:copy> <xsl:apply-templates select="node()|@*" mode="firststep" /> </xsl:copy> </xsl:template> <xsl:template match="connection[contains(@destination, 'event')]" mode="firststep"> <xsl:copy> <xsl:attribute name="block" select="substring-before(@source, '/')" /> <xsl:attribute name="source" select="substring-after(@source, '/')" /> <xsl:attribute name="destination" select="substring-after(@destination, '/')" /> </xsl:copy> </xsl:template> 2. Proceed like you did, but with the XSLT 2.0 version of the following. <xsl:template match="/"> <xsl:apply-templates select="exsl:node-set($firststep)" /> </xsl:template> 3. Use the below mentioned xsl:for-each ... group-by="@block" which should now be available to link the chains. Hope I didn't miss the point this time... Greetings Christoph yaswanth.mtrx@xxxxxxxxx schrieb am 29.08.2007 16:29:18: > Moreover it's not possible for me to give input in that format(Addig a new > block attribute ).. > > Any idea how to proceed ? > > > Regards, > Yaswanth > > -----Original Message----- > From: christoph.naber@xxxxxxxxxxxxxxxxxxx > [mailto:christoph.naber@xxxxxxxxxxxxxxxxxxx] > Sent: Wednesday, August 29, 2007 7:45 PM > To: yaswanth.mtrx@xxxxxxxxx > Subject: RE: Connecting the Source and Destination fields > > Hello, > > with respect to the reply from Ronan Klyne, I thought that it would be > possible to use micro-pipelining in order to change your input slightly to > fit the example below. > > > RONAN KLYNE > > Would you be able to change your input XML to look like this? > > > > <connection block="block.0" destination="event.1" source="event.0"/> > > <connection block="block.0" destination="event.2" source="event.1"/> > > <connection block="block.1" destination="event.4" source="event.3"/> > > <connection block="block.1" destination="event.5" source="event.4"/> > > <connection destination="block.1" source="block.0"/ > > > > Then (as mentioned by Ronan), > > > > the problem becomes much easier, as you can use <xsl:for-each > > > group-by="@block">, then link the chains up as before... > > Greetings Christoph > > > > yaswanth.mtrx@xxxxxxxxx schrieb am 29.08.2007 16:00:31: > > > Hi All, > > Christoph, Thanks for the reply .. > > After having a look at past posts regarding micro-pipelining... > > If I am not wrong, by applying micro-pipelining technique we are trying > to > > get an output which in turn is processed to get the actual output. > > Please correct if I am wrong. I think I am not ! > > > > I think even after sorting my input (using micro-pipelining) I will not > be > > able to get the desired output. > > > > For the below input: > > > > <connection destination="block.0/event.1" source="block.0/event.0"/> > > <connection destination="block.0/event.2" source="block.0/event.1"/> > > > > <connection destination="block.1/event.4" source="block.1/event.3"/> > > <connection destination="block.1/event.5" source="block.1/event.4"/> > > > > <connection destination="block.2/event.7" source="block.2/event.6"/> > > <connection destination="block.2/event.8" source="block.2/event.7"/> > > > > <connection destination="block.2" source="block.0"/> > > <connection destination="block.1" source="block.2"/> > > > > > > I am expecting > > block.0 -> block.2 -> block.1 > > > > i.e. where each block is replaced with the connections of events in that > > block .. I get > > > > --------------------- > > > > (block.0/event.0 -> block.0/event.1 - > block.0/event.2) > > -> > > (block.2/event.6 -> block.2/event.7 - > block.2/event.8) > > -> > > (block.1/event.3 -> block.1/event.4 - > block.1/event.5) > > > > --------------------- > > This is what exactly I am expecting > > > > > > Thanks > > Yaswanth > > > > > > -----Original Message----- > > From: christoph.naber@xxxxxxxxxxxxxxxxxxx > > [mailto:christoph.naber@xxxxxxxxxxxxxxxxxxx] > > Sent: Wednesday, August 29, 2007 6:41 PM > > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > > Subject: Re: Connecting the Source and Destination fields > > > > This seems to be a use-case for the in another thread mentioned so-called > > > "micro-pipelining". First process the input data to make them fit your > > needs, then do whatever you want with the cleaned up data. > > > > Hope I got it right this time... > > > > Greetings Christoph > > > > ronan.klyne@xxxxxxxxxxx schrieb am 29.08.2007 14:43:43: > > > > > Yaswanth wrote: > > > > > > > > Hi > > > > > > > >> How should the stylesheet know that the 'block.x' part of the string > > > is > > > >> special and to be treated in this way? Is the '/' separator special? > > > >> Should all lines be joined in this manner or should it be governed > by > > > >> line 3? > > > > > > > > Let me explain clearly > > > > > > > > Basically a block which will have events connected to each other and > > > that > > > > block can connect to the another block which will have it's own set > of > > > > events connected. > > > > > > > > <connection destination="block.1" source="block.0"/> > > > >>From this we understand that one block is followed by another block. > > > > > > > > But in the output I don't want to mention block.0 -> block.1 . > > > > Instead I need to have the event sequence in block.0 -> event > sequence > > in > > > > block.1 > > > > > > > > I think this will give a better idea about the problem. > > > > > > > > > > Would you be able to change your input XML to look like this? > > > > > > <connection block="block.0" destination="event.1" source="event.0"/> > > > <connection block="block.0" destination="event.2" source="event.1"/> > > > <connection block="block.1" destination="event.4" source="event.3"/> > > > <connection block="block.1" destination="event.5" source="event.4"/> > > > <connection destination="block.1" source="block.0"/> > > > > > > If so, the problem becomes much easier, as you can use <xsl:for-each > > > group-by="@block">, then link the chains up as before... > > > > > > # r > > > > > > -- > > > Ronan Klyne > > > Business Collaborator Developer > > > Tel: +44 (0)870 163 2555 > > > ronan.klyne@xxxxxxxxxxx > > > www.groupbc.com > > > > > > > > > > > If you are not the intended addressee, please inform us immediately that > you > > have received this e-mail by mistake and delete it. We thank you for your > > support. > > > > > > If you are not the intended addressee, please inform us immediately that you > have received this e-mail by mistake and delete it. We thank you for your > support. > If you are not the intended addressee, please inform us immediately that you have received this e-mail by mistake and delete it. We thank you for your support.
|
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
|