Jump to content

Processing text using XSL


ATM
 Share

Recommended Posts

Hey,I am trying to make an xsl stylesheet to process wikipedia text.for example <body>[[public transport]]</body>would be transformed into<body><a>public transport</a><body>I know I could do this in a number of different languages, but I would really like to do it in xsl for specific reasons.I have tried using transform function but have only been able to transform one character into another character, for example[[ into aaand the output is not as xml or html just raw text.Can anyone help me with this.Kind regardsRyan

Link to comment
Share on other sites

XSLT 1.0 can't do this natively.With ELXST's str:replace you can perform a sort of regular expression replacement, and then, using the "disable-output-escaping" attribute in xsl:value-of, turn that into an actual element.XSLT 2.0, or should I say XPath 2.0, has a string replace functionality built in, again back to a string, and with a character map, you can emulate the disable-output-escaping attribute (which for legacy purposes is available in most implementations out there).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...