Can I use a combination of id's in result-document@href?
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 16
- Joined: Wed Jun 29, 2011 12:28 pm
Can I use a combination of id's in result-document@href?
My problem is that I have to split a learningAssessment topic into several topics, for each child of lcInteraction.
I wrote this:
But this isn't working 
I want/need as file name the combination of the learningAssessment@id and the id of the lcInteraction child.
I wrote this:
Code: Select all
<xsl:template match="lcInteraction">
<xsl:for-each select="*">
<xsl:result-document method="xml" href="{concat(/learningAssessment/@id, '-', ./@id, '.xml')}">
<xsl:element name="qti:assessmentItem">
<xsl:attribute name="identifier">
<xsl:value-of select="concat(/learningAssessment/@id, '-', ./@id)"/>
</xsl:attribute>
</xsl:element>
</xsl:result-document>
</xsl:for-each>
</xsl:template>

I want/need as file name the combination of the learningAssessment@id and the id of the lcInteraction child.
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Can I use a combination of id's in result-document@href?
Hi,
Have you tried to add xsl:messages in your XSLT stylesheet to debug why this does not work?
Like:
I tried to create a sample XML document:
and an XSLT stylesheet:
and the child element of "lcInteraction" seems to be saved inside a new file. But it depends if this is exactly what you want.
Regards,
Radu
Have you tried to add xsl:messages in your XSLT stylesheet to debug why this does not work?
Like:
Code: Select all
<xsl:message>OUTPUT TO <xsl:value-of select="concat(/learningAssessment/@id, '-', ./@id, '.xml')"/></xsl:message>
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE learningAssessment PUBLIC "-//OASIS//DTD DITA Learning Assessment//EN" "learningAssessment.dtd">
<learningAssessment id="assessment_flp_syq_ylb">
<title></title>
<shortdesc></shortdesc>
<learningAssessmentbody>
<lcInteraction id="lcInteraction_q5y_yyq_ylb">
<lcHotspot id="lcHotspot_llc_zyq_ylb">
<lcQuestion/>
<lcHotspotMap id="lcHotspotMap_mlc_zyq_ylb">
<image id="image_nlc_zyq_ylb"/>
<lcArea>
<lcAreaShape/>
<lcAreaCoords/>
</lcArea>
</lcHotspotMap>
</lcHotspot>
</lcInteraction>
</learningAssessmentbody>
</learningAssessment>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="lcInteraction">
<xsl:for-each select="*">
<xsl:message>OUTPUT TO <xsl:value-of select="concat(/learningAssessment/@id, '-', ./@id, '.xml')"/></xsl:message>
<xsl:result-document method="xml" href="{concat(/learningAssessment/@id, '-', ./@id, '.xml')}">
<xsl:element name="qti:assessmentItem" xmlns:qti="test">
<xsl:attribute name="identifier">
<xsl:value-of select="concat(/learningAssessment/@id, '-', ./@id)"/>
</xsl:attribute>
</xsl:element>
</xsl:result-document>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
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