473,404 Members | 2,170 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

XSLT: Copy-of with condition

Hi!
I am working on a xml->xml transformation. The source-file contains
the following entities:

<ef:Test>
....
....
<ef:ID>1234</ef:ID>
</ef:Test>
<ef:errorReference>
....
....
<ef:reference_test>1234</ef:referemce_test>
</ef:errorReference>
<ef:errorReference>
....
....
<ef:reference_test>2345</ef:reference_test>
</ef:errorReference>

My transformation is supposed to filter for every single test those
corresponding errorReferences, that have a <ef:reference_test>-value
matching the <ef:ID>-value of the current test.
So I´ve been trying...

<xsl:template match="/">
....
....
<xsl:apply-templates select="ef:Test"/>
</xsl:template match>

<xsl:template match="ef:Test">
<xsl:variable name="testID" select="ef:ID"/>
<!--xsl:copy-of select="..//ef:Fehlerzuordnung[Referenz_Test =
ef:ID]"/-->
<xsl:copy-of select="..//ef:Fehlerzuordnung[Referenz_Test =
$testID]"/>
</xsl:template>

Both alternatives WON´T work. Neither the one commented out, nor the
one currently in place. I suppose the path or the variable is no
longer valid in that call, respectively.
So far I haven´t come up with a solution, can somebody help me?

Thank you,
Andreas

Feb 23 '07 #1
3 2379
Aargh I forgot to translate the most important lines :\. Please have a
look again

On 23 Feb., 08:13, adu...@cs.tu-berlin.de wrote:
Hi!
I am working on a xml->xml transformation. The source-file contains
the following entities:

<ef:Test>
...
...
<ef:ID>1234</ef:ID>
</ef:Test>
<ef:errorReference>
...
...
<ef:reference_test>1234</ef:referemce_test>
</ef:errorReference>
<ef:errorReference>
...
...
<ef:reference_test>2345</ef:reference_test>
</ef:errorReference>

My transformation is supposed to filter for every single test those
corresponding errorReferences, that have a <ef:reference_test>-value
matching the <ef:ID>-value of the current test.
So I´ve been trying...

<xsl:template match="/">
...
...
<xsl:apply-templates select="ef:Test"/>
</xsl:template match>

<xsl:template match="ef:Test">
<xsl:variable name="testID" select="ef:ID"/>
<!--xsl:copy-of select="..//ef:errorReference[reference_test =
ef:ID]"/-->
<xsl:copy-of select="..//ef:errorReference[reference_test =
$testID]"/>
</xsl:template>

Both alternatives WON´T work. Neither the one commented out, nor the
one currently in place. I suppose the path or the variable is no
longer valid in that call, respectively.
So far I haven´t come up with a solution, can somebody help me?

Thank you,
Andreas
Feb 23 '07 #2
In article <11**********************@j27g2000cwj.googlegroups .com>,
<ad****@cs.tu-berlin.dewrote:
><ef:errorReference>
...
...
<ef:reference_test>1234</ef:referemce_test>
</ef:errorReference>
> <xsl:copy-of select="..//ef:errorReference[reference_test =
$testID]"/>
You forgot the prefix. That should be [ef:reference_test = $testID]

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Feb 23 '07 #3
On 23 Feb., 22:54, rich...@cogsci.ed.ac.uk (Richard Tobin) wrote:
In article <1172216011.870605.203...@j27g2000cwj.googlegroups .com>,

<adu...@cs.tu-berlin.dewrote:
<ef:errorReference>
...
...
<ef:reference_test>1234</ef:referemce_test>
</ef:errorReference>
<xsl:copy-of select="..//ef:errorReference[reference_test =
$testID]"/>

You forgot the prefix. That should be [ef:reference_test = $testID]

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.

Yes you are absolutely right. Finally I got aware of it too and
knocked down the wall with my head... Thank you never the less!

Feb 26 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Christian Roth | last post by:
Hello, when using this "identity" processing sheet: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" encoding="iso-8859-1" /> ...
0
by: Manoj Nair | last post by:
I am using XSLT / XSL-FO to convert my XML to PDF file for the users to take a printout. Under certain conditions I need to have a watermark COPY on the printed paper . Can XSL-FO/XSLT do this for...
3
by: Peter Kirk | last post by:
Hi I am a C# programmer writing a program which is to provide functions for transforming a supplied xml document with a supplied xslt document, and streaming the output to a supplied stream. ...
6
by: naima.mans | last post by:
Hello :) I'm newbie to XSLT and i need some advice please: Here the action: I have to browse an XML file with xslt : For each node i have to determinate if it is a node where i need to add...
8
by: Hercules Dev. | last post by:
Hi all, I'm new in xslt and xpath, so my question might be simple but i'm learning. I have an XML document and need to transform it into another XML, I use xslt and it works, but there is a...
2
by: olivier.scalbert | last post by:
Hello, How can I write the XSLT to transform: <Root> <Element attribute="value"/> <Element2> <Element3/> </Element2> </Root>
3
by: Andy Dingley | last post by:
>From a thread over in c.i.w.a.h "RFC: From XHTML to HTML via XSLT" http://groups.google.co.uk/group/comp.infosystems.www.authoring.html/msg/f112c230061ffe86 As is well-known, the XSLT HTML...
1
by: Karsten | last post by:
Hello How do I copy most of a xml file, but change a few attributes and/or elements based on a xpath? How do I make the xslt file? I know this description isn't much, but here is a small...
6
by: kluge.wolfram | last post by:
Hi, i get stucked on a transformation problem using XSLT. What i need is to copy an XML Tree to an output XML without any automatic changes. Since i used <xsl:copyor <xsl:copy-ofthere occur...
1
by: mahendra dubey | last post by:
Hi there I am using XSLT to process an XML file.I want to copy all whole XML and want to modify some attribute node.I using follwing code <?xml version="1.0" encoding="utf-8"?>...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.