[oXygen-user] copy of processing instructions

George Cristian Bina george at oxygenxml.com
Fri May 24 01:32:43 CDT 2013


Hi Ulrike,

I am afraid I do not have enough information to understand what you did 
before and what you are doing now.

There is no XML transformation scenario type, probably you are referring 
to "XML transformation with XSLT". This type of transformation scenario 
is intended to be applied when the current document is an XML document. 
Functionally this is equivalent to an "XSLT transformation" scenario, 
bit this one is intended to be applied when the current document is an 
XSLT document. This is to allow reusing the same scenario for different 
XML documents and different XSLT documents, because when you define a 
scenario you can use editor variables that will be expanded at execution 
time, the most used such variable being the ${currentFileURL} variable 
that is expanded to point to the current file.

Here it is an example: if you have an XSLT stylesheet named test.xsl and 
many XML documents that should be transformed with that XSLT then you 
can define a single transformation scenario that you will apply whenever 
such an XML file is your current file, to invoke the transformation with 
test.xsl.
You can define an "XML transformation with XSLT" scenario and use as XML 
URL ${currentFileURL} and as XSLT URL you can enter the URL for your 
test.xsl stylesheet.
Thus, when your current file is x.xml the ${currentFileURL} will point 
to that and the scenario will use x.xml as XML input and test.xml as 
stylesheet.

This is placed in the "XML transformation with XSLT" category to avoid 
displaying this by default when the current file is an XSLT stylesheet. 
When you have test.xsl as the current file you should define an "XSLT 
Transformation" scenario that should use ${currentFileURL} as the XSLT 
URL and specify a specific XML file as the input.

Of course you can also use editor variables to have more generic 
scenarios. You can define a scenario that for any XML file applies an 
XSLT having the same name as the XML file, so for text.xml it will apply 
test.xsl, for x.xml it will apply x.xsl and so on. For that you can use 
as XML URL ${currentFileURL} and for XSLT URL ${cfdu}/${cfn}.xsl
where ${cfdu} is current file directory URL and ${cfn} is current file 
name without extension.

Best Regards,
George
--
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

On 5/24/13 8:28 AM, Ulrike Borinski wrote:
> Dear George,
>
> I found an answer: I changed the Transformation Scenario from type XML
> to type XSLT - and now the result has both: the deep copy and the
> transformed attribute.
> What exactly is the difference? Could you please give me some Information?
>
> example XML:
> <Textebene-1>
>         <Überschrift>Das erste Kapitel</Überschrift>
>         <Sinneinheit>
>             <Absatz>Ein beispielhafter Absatz …</Absatz>
>             <Definition>
>                 <Absatz>Eine beispielhafte Definition …</Absatz>
>             </Definition>
>             <Absatz>Ein beispielhafter Absatz …</Absatz>
>         </Sinneinheit>
>     </Textebene-1>
>
> The example XSLT is below.
>
> Result:
> <Textebene-1>
>         <Überschrift Referenz="ü-1_Das-erste-Kapitel_000001">Das erste
> Kapitel</Überschrift>
>         <Sinneinheit>
>             <Absatz>Ein beispielhafter Absatz …</Absatz>
>             <Definition Referenz="Def-001_000001">
>                 <Absatz>Eine beispielhafte Definition …</Absatz>
>             </Definition>
>             <Absatz>Ein beispielhafter Absatz …</Absatz>
>         </Sinneinheit>
>     </Textebene-1>
>
> Best regards
> Ulrike
>
> Am 23.05.2013 um 11:20 schrieb George Cristian Bina:
>
>> Dear Ulrike,
>>
>> In order to be able to help you please provide a very small example
>> XML and XSLT that show a sample input, the templates you use and then
>> let us know what you should expect as output.
>>
>> Best Regards,
>> George
>> --
>> George Cristian Bina
>> <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
>> http://www.oxygenxml.com <http://www.oxygenxml.com/>
>>
>> On 5/23/13 10:38 AM, Ulrike Borinski wrote:
>>> Thank you very much - you and Syd,
>>>
>>> I would like to generate an attribute with value on this way. I tried
>>> to combine your coding with something like this:
>>>
>>> <xsl:template match="Definition">
>>>        <xsl:copy>
>>>            <xsl:attribute name="Referenz">
>>>                <xsl:text>Def-</xsl:text>
>>>                <xsl:number count="Definition" level="any" format="001"/>
>>>                <xsl:text>_</xsl:text>
>>>                <xsl:value-of select="//Content-ID"/>
>>>            </xsl:attribute>
>>>            <xsl:apply-templates select="@* | node()"/>
>>>        </xsl:copy>
>>>    </xsl:template>
>>>
>>> the copy is OK (deep), but nothing else happens
>>>
>>> Regards,
>>> Ulrike Borinski
>>>
>>>
>>> Am 22.05.2013 um 15:15 schrieb Oxygen XML Editor Support:
>>>
>>>> Hi,
>>>>
>>>> You can use a deep copy stylesheet that also considers the
>>>> processing instructions.
>>>>
>>>> This is a modified version of the sample copy stylesheet from the
>>>> Oxygen samples (Oxygen/samples/xhtml/copy.xsl):
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <xsl:stylesheet version="1.0"
>>>> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>>>>    <xsl:output method="xml"/>
>>>>    <!-- Match document -->
>>>>    <xsl:template match="/">
>>>>        <xsl:apply-templates mode="copy" select="."/>
>>>>    </xsl:template>
>>>>    <!-- Deep copy template -->
>>>>    <xsl:template match="*|text()|@*|processing-instruction()"
>>>> mode="copy">
>>>>        <xsl:copy>
>>>>            <xsl:apply-templates mode="copy" select="@*"/>
>>>>            <xsl:apply-templates mode="copy"/>
>>>>        </xsl:copy>
>>>>    </xsl:template>
>>>>    <!-- Handle default matching -->
>>>>    <xsl:template match="*"/>
>>>> </xsl:stylesheet>
>>>>
>>>> The only change I made was to the deep copy template. I've added:
>>>> processing-instruction()
>>>>    <xsl:template match="*|text()|@*|processing-instruction()"
>>>> mode="copy">
>>>>
>>>> Regards,
>>>> Adrian
>>>>
>>>>
>>>> On 22.05.2013 13:17, Ulrike Borinski wrote:
>>>>> Hello,
>>>>>
>>>>> I want to transform some XML-Documents containing some Track
>>>>> Changes Markup, <?oxy_delete?> for example. I need a deep copy of
>>>>> the document.
>>>>> How can I preserve these PIs during a XSLT-Transformation?
>>>>>
>>>>> Thank you
>>>>> Ulrike Borinski
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
>>>>> . . . . . . .
>>>>> Ulrike Borinski
>>>>> Dipl.-Designerin
>>>>>
>>>>> Koordination
>>>>> Servicestelle Mediengestaltung und Publishing
>>>>>
>>>>> Borinski at ifv-nrw.de <mailto:Borinski at ifv-nrw.de>
>>>>>
>>>>> 02331/9330-927
>>>>>
>>>>>
>>>>> www.ifv-nrw.de/ifv_gest/lerneinheiten.htm
>>>>> <http://www.ifv-nrw.de/ifv_gest/lerneinheiten.htm>
>>>>>
>>>>>
>>>>> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
>>>>> . . . . . . .
>>>>> Institut für Verbundstudien der Fachhochschulen
>>>>> Nordrhein-Westfalens - IfV NRW
>>>>> Im Alten Holz 131
>>>>> 58093 Hagen
>>>>>
>>>>> _______________________________________________
>>>>> oXygen-user mailing list
>>>>>
>>>>> oXygen-user at oxygenxml.com <mailto:oXygen-user at oxygenxml.com>
>>>>> http://www.oxygenxml.com/mailman/listinfo/oxygen-user
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> Adrian Buza
>>>> oXygen XML Editor and Author Support
>>>>
>>>> Tel: +1-650-352-1250 ext.202
>>>> Fax: +40-251-461482
>>>>
>>>> support at oxygenxml.com <mailto:support at oxygenxml.com>
>>>> http://www.oxygenxml.com <http://www.oxygenxml.com/>
>>>
>>> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
>>> . . . . . .
>>> Ulrike Borinski
>>> Dipl.-Designerin
>>>
>>> Koordination
>>> Servicestelle Mediengestaltung und Publishing
>>> Borinski at ifv-nrw.de <mailto:Borinski at ifv-nrw.de>
>>> 02331/9330-927
>>>
>>> www.ifv-nrw.de/ifv_gest/lerneinheiten.htm
>>> <http://www.ifv-nrw.de/ifv_gest/lerneinheiten.htm>
>>>
>>> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
>>> . . . . . .
>>> Institut für Verbundstudien der Fachhochschulen Nordrhein-Westfalens
>>> - IfV NRW
>>> Im Alten Holz 131
>>> 58093 Hagen
>>>
>>> _______________________________________________
>>> oXygen-user mailing list
>>> oXygen-user at oxygenxml.com <mailto:oXygen-user at oxygenxml.com>
>>> http://www.oxygenxml.com/mailman/listinfo/oxygen-user
>>>
>
> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
> . . . . .
> Ulrike Borinski
> Dipl.-Designerin
>
> Koordination
> Servicestelle Mediengestaltung und Publishing
> Borinski at ifv-nrw.de <mailto:Borinski at ifv-nrw.de>
> 02331/9330-927
>
> www.ifv-nrw.de/ifv_gest/lerneinheiten.htm
> <http://www.ifv-nrw.de/ifv_gest/lerneinheiten.htm>
>
> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
> . . . . .
> Institut für Verbundstudien der Fachhochschulen Nordrhein-Westfalens -
> IfV NRW
> Im Alten Holz 131
> 58093 Hagen
> Am 23.05.2013 um 11:20 schrieb George Cristian Bina:
>
>> Dear Ulrike,
>>
>> In order to be able to help you please provide a very small example
>> XML and XSLT that show a sample input, the templates you use and then
>> let us know what you should expect as output.
>>
>> Best Regards,
>> George
>> --
>> George Cristian Bina
>> <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
>> http://www.oxygenxml.com
>>
>> On 5/23/13 10:38 AM, Ulrike Borinski wrote:
>>> Thank you very much - you and Syd,
>>>
>>> I would like to generate an attribute with value on this way. I tried
>>> to combine your coding with something like this:
>>>
>>> <xsl:template match="Definition">
>>>         <xsl:copy>
>>>             <xsl:attribute name="Referenz">
>>>                 <xsl:text>Def-</xsl:text>
>>>                 <xsl:number count="Definition" level="any" format="001"/>
>>>                 <xsl:text>_</xsl:text>
>>>                 <xsl:value-of select="//Content-ID"/>
>>>             </xsl:attribute>
>>>             <xsl:apply-templates select="@* | node()"/>
>>>         </xsl:copy>
>>>     </xsl:template>
>>>
>>> the copy is OK (deep), but nothing else happens
>>>
>>> Regards,
>>> Ulrike Borinski
>>>
>>>
>>> Am 22.05.2013 um 15:15 schrieb Oxygen XML Editor Support:
>>>
>>>> Hi,
>>>>
>>>> You can use a deep copy stylesheet that also considers the
>>>> processing instructions.
>>>>
>>>> This is a modified version of the sample copy stylesheet from the
>>>> Oxygen samples (Oxygen/samples/xhtml/copy.xsl):
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <xsl:stylesheet version="1.0"
>>>> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>>>>     <xsl:output method="xml"/>
>>>>     <!-- Match document -->
>>>>     <xsl:template match="/">
>>>>         <xsl:apply-templates mode="copy" select="."/>
>>>>     </xsl:template>
>>>>     <!-- Deep copy template -->
>>>>     <xsl:template match="*|text()|@*|processing-instruction()"
>>>> mode="copy">
>>>>         <xsl:copy>
>>>>             <xsl:apply-templates mode="copy" select="@*"/>
>>>>             <xsl:apply-templates mode="copy"/>
>>>>         </xsl:copy>
>>>>     </xsl:template>
>>>>     <!-- Handle default matching -->
>>>>     <xsl:template match="*"/>
>>>> </xsl:stylesheet>
>>>>
>>>> The only change I made was to the deep copy template. I've added:
>>>> processing-instruction()
>>>>     <xsl:template match="*|text()|@*|processing-instruction()"
>>>> mode="copy">
>>>>
>>>> Regards,
>>>> Adrian
>>>>
>>>>
>>>> On 22.05.2013 13:17, Ulrike Borinski wrote:
>>>>> Hello,
>>>>>
>>>>> I want to transform some XML-Documents containing some Track
>>>>> Changes Markup, <?oxy_delete?> for example. I need a deep copy of
>>>>> the document.
>>>>> How can I preserve these PIs during a XSLT-Transformation?
>>>>>
>>>>> Thank you
>>>>> Ulrike Borinski
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
>>>>> . . . . . . .
>>>>> Ulrike Borinski
>>>>> Dipl.-Designerin
>>>>>
>>>>> Koordination
>>>>> Servicestelle Mediengestaltung und Publishing
>>>>>
>>>>> Borinski at ifv-nrw.de
>>>>>
>>>>> 02331/9330-927
>>>>>
>>>>>
>>>>> www.ifv-nrw.de/ifv_gest/lerneinheiten.htm
>>>>>
>>>>>
>>>>> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
>>>>> . . . . . . .
>>>>> Institut für Verbundstudien der Fachhochschulen
>>>>> Nordrhein-Westfalens - IfV NRW
>>>>> Im Alten Holz 131
>>>>> 58093 Hagen
>>>>>
>>>>> _______________________________________________
>>>>> oXygen-user mailing list
>>>>>
>>>>> oXygen-user at oxygenxml.com
>>>>> http://www.oxygenxml.com/mailman/listinfo/oxygen-user
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> Adrian Buza
>>>> oXygen XML Editor and Author Support
>>>>
>>>> Tel: +1-650-352-1250 ext.202
>>>> Fax: +40-251-461482
>>>>
>>>> support at oxygenxml.com
>>>> http://www.oxygenxml.com
>>>
>>> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
>>> . . . . . .
>>> Ulrike Borinski
>>> Dipl.-Designerin
>>>
>>> Koordination
>>> Servicestelle Mediengestaltung und Publishing
>>> Borinski at ifv-nrw.de
>>> 02331/9330-927
>>>
>>> www.ifv-nrw.de/ifv_gest/lerneinheiten.htm
>>>
>>> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
>>> . . . . . .
>>> Institut für Verbundstudien der Fachhochschulen Nordrhein-Westfalens
>>> - IfV NRW
>>> Im Alten Holz 131
>>> 58093 Hagen
>>>
>>> _______________________________________________
>>> oXygen-user mailing list
>>> oXygen-user at oxygenxml.com
>>> http://www.oxygenxml.com/mailman/listinfo/oxygen-user
>>>
>
> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
> . . . . .
> Ulrike Borinski
> Dipl.-Designerin
>
> Koordination
> Servicestelle Mediengestaltung und Publishing
> Borinski at ifv-nrw.de <mailto:Borinski at ifv-nrw.de>
> 02331/9330-927
>
> www.ifv-nrw.de/ifv_gest/lerneinheiten.htm
>
> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
> . . . . .
> Institut für Verbundstudien der Fachhochschulen Nordrhein-Westfalens -
> IfV NRW
> Im Alten Holz 131
> 58093 Hagen
>
>
>
> _______________________________________________
> oXygen-user mailing list
> oXygen-user at oxygenxml.com
> http://www.oxygenxml.com/mailman/listinfo/oxygen-user
>


More information about the oXygen-user mailing list