Radiobuttons in XML / XSL
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 4
- Joined: Fri Apr 04, 2014 2:32 pm
Radiobuttons in XML / XSL
First: Sorry, my english is not the best, but I try to write as good as possible.
My Path in .XML file:
If in .XML file in
is a "yes", then the result should be:
yes (radiobutton=checked) (radiobutton) no
If in .XML in
is a "no", then the result should be:
yes (radiobutton) (radiobutton=checked) no
In my .XSL file it looks like this as far:
I don't know how I get the radiobuttons to the correct place. I tried different solutions of Google, but they also don't work.
Maybe somebody can help me! Thank you very much!
Greetings, Mario
My Path in .XML file:
Code: Select all
<ClinicalDocument>
<recordTarget>
<patientRole>
<rezeptgebuehrenbefreiung>ja</rezeptgebuehrenbefreiung>
Code: Select all
<rezeptgebuehrenbefreiung>
yes (radiobutton=checked) (radiobutton) no
If in .XML in
Code: Select all
<rezeptgebuehrenbefreiung>
yes (radiobutton) (radiobutton=checked) no
In my .XSL file it looks like this as far:
Code: Select all
...
<xsl:variable name="rezeptgebbefr">
<xsl:choose>
<xsl:when test="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:rezeptgebuehrenbefreiung">
<xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:rezeptgebuehrenbefreiung"/>
</xsl:when>
<xsl:otherwise>unspecified</xsl:otherwise>
</xsl:choose>
</xsl:variable>
...
Maybe somebody can help me! Thank you very much!
Greetings, Mario
-
- Posts: 99
- Joined: Thu Oct 23, 2008 6:29 am
Re: Radiobuttons in XML / XSL
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<n1:ClinicalDocument xmlns:n1="localhost">
<n1:recordTarget>
<n1:patientRole>
<n1:rezeptgebuehrenbefreiung>yes</n1:rezeptgebuehrenbefreiung>
</n1:patientRole>
</n1:recordTarget>
</n1:ClinicalDocument>
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"
xmlns:n1="localhost" exclude-result-prefixes="xs" version="1.0">
<xsl:output method="html"/>
<xsl:template match="/">
<html>
<head><title>test</title></head>
<body>
<form action="">
<xsl:if test="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:rezeptgebuehrenbefreiung='yes'">
<xsl:text disable-output-escaping="yes"><input type="radio" name="answer" value="yes" checked>Yes</xsl:text>
<xsl:text disable-output-escaping="yes"><input type="radio" name="answer" value="no">No</xsl:text>
</xsl:if>
<xsl:if test="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:rezeptgebuehrenbefreiung='no'">
<xsl:text disable-output-escaping="yes"><input type="radio" name="answer" value="yes">Yes</xsl:text>
<xsl:text disable-output-escaping="yes"><input type="radio" name="answer" value="no" checked>No</xsl:text>
</xsl:if>
</form>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Return to “General XML Questions”
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