By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,186 Members | 1,530 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,186 IT Pros & Developers. It's quick & easy.

use xsl:element to output an "<xsl:template match=...> ?

P: n/a
hi, trying to use an xslt to make an xslt. trying something like:

<?xml version="1.0" encoding="UTF-8"?>
<?xmlspysamplexml H:\java\projects\spy1\spy\inputDocumentMap.xml?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/inputDocumentMap">
<xsl:element name="xsl:template" match="/inputDocument">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>

but this is not going very well (the files are at:
http://tayek.com/~ray/spy1/

i want to create the sampleT1.xslt file (which will eat
inputDocument.xml) from inputDocumentMap.xml. the sampleT1 works fine
(at least in java, but xmlspy produces garbage). i want to create this
file programmatically.

i would assume that this (creating an xslt from an xslt and an xml)
*can* be done but maybe it would be better to do it in java as i am a
newbie to xslt (it's my first functional langauge). i have done this
with a previous incarnation of the sampleT1.xslt, so it's not a problem,
but it would be cool to do it in xslt.

any pointers would be apreciated.

thanks
---
ray tayek http://tayek.com/ actively seeking mentoring or telecommuting work
vice chair orange county java users group http://www.ocjug.org/
hate spam? http://samspade.org/ssw/
Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Ray Tayek wrote:
hi, trying to use an xslt to make an xslt. trying something like:

...
<xsl:template match="/inputDocumentMap">
<xsl:element name="xsl:template" match="/inputDocument">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>


this may be working a bit better:

<?xml version="1.0" encoding="UTF-8"?>
<?xmlspysamplexml H:\java\projects\spy1\spy\inputDocumentMap.xml?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/inputDocumentMap">
<xsl:element name="xsl:template">
<xsl:attribute name="match">/inputDocumentt</xsl:attribute>
<!--xsl:attribute name="xml:space">preserve</xsl:attribute>-->
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
---
ray tayek http://tayek.com/ actively seeking mentoring or telecommuting work
vice chair orange county java users group http://www.ocjug.org/
hate spam? http://samspade.org/ssw/
Jul 20 '05 #2

P: n/a
Read also about the
xsl:namespace-alias
instruction.

Using it to produce an xsl:stylesheet as the result of the transformation is
more convenient than using xsl:element.

Of course, it is also recommended to try another solution that solves your
problem directly, without having to produce an intermediate stylesheet.

=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL

"Ray Tayek" <rt*******@spam.comcast.net> wrote in message
news:sXhyb.260314$9E1.1380781@attbi_s52...
Ray Tayek wrote:
hi, trying to use an xslt to make an xslt. trying something like:

...
<xsl:template match="/inputDocumentMap">
<xsl:element name="xsl:template" match="/inputDocument">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>

this may be working a bit better:

<?xml version="1.0" encoding="UTF-8"?>
<?xmlspysamplexml H:\java\projects\spy1\spy\inputDocumentMap.xml?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/inputDocumentMap">
<xsl:element name="xsl:template">
<xsl:attribute name="match">/inputDocumentt</xsl:attribute>
<!--xsl:attribute name="xml:space">preserve</xsl:attribute>-->
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
---
ray tayek http://tayek.com/ actively seeking mentoring or telecommuting

work vice chair orange county java users group http://www.ocjug.org/
hate spam? http://samspade.org/ssw/

Jul 20 '05 #3

P: n/a
Dimitre Novatchev wrote:
Read also about the xsl:namespace-alias instruction.
ok
Using it to produce an xsl:stylesheet as the result of the transformation is
more convenient than using xsl:element.

Of course, it is also recommended to try another solution that solves your
problem directly, without having to produce an intermediate stylesheet.

that is a great idea, but i ahev no clue how to do it.

i have a sample of the desired type of xslt that i want to produce
called sampleT1.xsl at http://tayek.com/~ray/spy1/. it transforms the
inputDocument.xml into what is needed. (the problem is to consume .csv's
from excel that have notes with line breaks and ' and " and space
charaters in the field names, so i have a csvparser that makes
inputDocument.xml from the lusers' .csv).

another input is the inputDocumentMap.xml which describes the processing
that needs to be done on the inputDocument.xml file (this involves
renaming fields, deleting fields, mapping data values of fields, and
outputting records based on trigger fields in the input records).

the idea is to let the user define the processing to be done on his csv
file to get it into our xml/csv format, so this is done by a web app and
i will get an inputDocumentMap.xml from this user interaction and then
he can upload his .csv's so we can process them and stick 'em in our system.

thanks

"Ray Tayek" <rt*******@spam.comcast.net> wrote in message
news:sXhyb.260314$9E1.1380781@attbi_s52...
Ray Tayek wrote:
hi, trying to use an xslt to make an xslt. trying something like:
....

this may be working a bit better:

<?xml version="1.0" encoding="UTF-8"?>
<?xmlspysamplexml H:\java\projects\spy1\spy\inputDocumentMap.xml?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/inputDocumentMap">
<xsl:element name="xsl:template">
<xsl:attribute name="match">/inputDocumentt</xsl:attribute>
<!--xsl:attribute name="xml:space">preserve</xsl:attribute>-->
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>

---
ray tayek http://tayek.com/ actively seeking mentoring or telecommuting work
vice chair orange county java users group http://www.ocjug.org/
hate spam? http://samspade.org/ssw/
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.