Subject: Re: [xsl] Identifying two tags that share some attribute names and values From: Joerg.Heinicke@xxxxxx Date: Sun, 5 May 2002 12:06:36 +0200 (MEST) |
> That's a problem, because 2.xml may contain thousands of entries, and I > don't want to process each one. I just want to process the <a> from 1.xml > and find any corresponding <b> in 2.xml. Hi Zack, I can't imagine, that this is possible. Maybe with creating a Result Tree Fragment (RTF), but then you need a processor specific extension function, which transforms the RTF back to a nodeset. But maybe other people have better ideas than me. Joerg >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > On Sat, May 04, 2002 at 09:18:45PM +0200, Joerg Heinicke wrote: > > Hello Zack, > > > > I have a solution, but I don't know whether it's the optimum. > > That was fast! > > > I didn't > > get it with one expression and need the step with $test: > > > > <xsl:variable name="file1" select="/"/> > > <xsl:variable name="file2" select="document('2.xml')/outsidedata"/> > > > > <xsl:template match="/"> > > <xsl:apply-templates select="$file2/b"/> > > That's a problem, because 2.xml may contain thousands of entries, and I > don't want to process each one. I just want to process the <a> from 1.xml > and find any corresponding <b> in 2.xml. > > > </xsl:template> > > > > <xsl:template match="b"> > > <xsl:variable name="test"> > > <xsl:for-each select="@*"> > > <xsl:if test="$file1/a/@*[name()=name(current())][. != > > current()] or not($file1/a/@*[name()=name(current())])"> > > <xsl:text>false</xsl:text> > > </xsl:if> > > </xsl:for-each> > > </xsl:variable> > > Nice hack! Even aside from the cool middle part, I like the idea of > looping > within a variable creation, in order to include a specific result that can > be tested for later. > > > <xsl:if test="not(contains($test, 'false'))"> > > <xsl:text>[</xsl:text> > > <xsl:value-of select="."/> > > <xsl:text>]</xsl:text> > > </xsl:if> > > </xsl:template> > > > > I test on every attribute whether it is in <a> and has a different value > > or it does completely not exist. If it is so I add a false to the > > test-string. If no 'false' is contained in $test, the value of b will be > > copied to the output. -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Identifying two tags that, David Carlisle | Thread | Re: [xsl] Identifying two tags that, Zack Brown |
Re: [xsl] Identifying two tags that, Jeni Tennison | Date | [xsl] Which has priority xml:space=, Sal Mangano |
Month |