I want to apply templates to some xml that my xsl has genera
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 4
- Joined: Sat Sep 23, 2006 8:23 pm
I want to apply templates to some xml that my xsl has genera
Here is my template for processing this data:
<Data>("Apr","1","2");("Ma""y","1","2");("Jun""","1","2";("Jul,05","2","2");(Aug,"45","76");("Sep","3","2");("Oct","1","2");("Nov","1","2");("Dec","1","2")</Data>
<xsl:template name="ParseData">
<xsl:call-template name="CSVProcess_String">
<xsl:with-param name="String"><xsl:value-of select="$RawData"/></xsl:with-param>
<xsl:with-param name="SubNodeName">row</xsl:with-param>
<xsl:with-param name="Delimiter">;</xsl:with-param>
<xsl:with-param name="QuoteChar">#</xsl:with-param>
</xsl:call-template>
</xsl:template>
this outputs:
<?xml version="1.0" encoding="utf-8"?>
<root>
<dataset>
<row>("Apr","1","2")</row>
<row>("Ma""y","1","2")</row>
<row>("Jun""","1","2"</row>
<row>("Jul,05","2","2")</row>
<row>(Aug,"45","76")</row>
<row>("Sep","3","2")</row>
<row>("Oct","1","2")</row>
<row>("Nov","1","2")</row>
<row>("Dec","1","2")</row>
</dataset>
</root>
But I then want to do template matching on this data, i.e. the same thing for every row.
I'm sure it's simple but I'm new to all this and not sure what to search for even.
Thanks in advance,
Alan
<Data>("Apr","1","2");("Ma""y","1","2");("Jun""","1","2";("Jul,05","2","2");(Aug,"45","76");("Sep","3","2");("Oct","1","2");("Nov","1","2");("Dec","1","2")</Data>
<xsl:template name="ParseData">
<xsl:call-template name="CSVProcess_String">
<xsl:with-param name="String"><xsl:value-of select="$RawData"/></xsl:with-param>
<xsl:with-param name="SubNodeName">row</xsl:with-param>
<xsl:with-param name="Delimiter">;</xsl:with-param>
<xsl:with-param name="QuoteChar">#</xsl:with-param>
</xsl:call-template>
</xsl:template>
this outputs:
<?xml version="1.0" encoding="utf-8"?>
<root>
<dataset>
<row>("Apr","1","2")</row>
<row>("Ma""y","1","2")</row>
<row>("Jun""","1","2"</row>
<row>("Jul,05","2","2")</row>
<row>(Aug,"45","76")</row>
<row>("Sep","3","2")</row>
<row>("Oct","1","2")</row>
<row>("Nov","1","2")</row>
<row>("Dec","1","2")</row>
</dataset>
</root>
But I then want to do template matching on this data, i.e. the same thing for every row.
I'm sure it's simple but I'm new to all this and not sure what to search for even.
Thanks in advance,
Alan
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Hi Alan,
You can direct all the output in a variable if the output is generated inside an xsl:variable element. For instance
<xsl:variable name="test">
<xsl:apply-templates/>
</xsl:variable>
will place everything generated by the apply-templates inside the test variable.
In XLT 1.0 what will be in the variable will be a result tree fragment. You need to convert that to a node set using your processor node-set extension and then you will be able to apply templates on those nodes with something like
<xsl:apply-templates select="$testNodeSet"/>
You can also have two transformations for this, note that oXygen allows you to define more XSLT stylesheets for a transformation scenario. Also the JAXP API allows you to specify more stylesheets when you do a transformation.
Best Regards,
George
You can direct all the output in a variable if the output is generated inside an xsl:variable element. For instance
<xsl:variable name="test">
<xsl:apply-templates/>
</xsl:variable>
will place everything generated by the apply-templates inside the test variable.
In XLT 1.0 what will be in the variable will be a result tree fragment. You need to convert that to a node set using your processor node-set extension and then you will be able to apply templates on those nodes with something like
<xsl:apply-templates select="$testNodeSet"/>
You can also have two transformations for this, note that oXygen allows you to define more XSLT stylesheets for a transformation scenario. Also the JAXP API allows you to specify more stylesheets when you do a transformation.
Best Regards,
George
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service